39 | | ^(Describe your design here.)^ |
| 39 | The browser consists of a Java and a native part. They communicate via the mechanism described in [wiki:GROUP_WRAPPERS_R0]. [[BR]][[BR]] |
| 40 | |
| 41 | |
| 42 | == Java part == |
| 43 | * NativeBrowserBridge extends NativeBridge. This is the browser wrapper that clients should use to get and control web content. |
| 44 | * In future revisions of this tasks client should be able to check if the page has been successfully loaded but for now empty images can be returned. |
| 45 | * Internally the bridge has four commands that should be implemented - load, grab page, send mouse event and send keyboard event. |
| 46 | * The grab page command returns a PageGrabResponse that contains a BufferedImage corresponding to the current web view in the native part. |
| 47 | |
| 48 | ---- |
| 49 | |
| 50 | == C++ part == |
| 51 | * The C++ part is built atop Qt, using QtWebKit which supplies a library of widgets with web functionality. |
| 52 | * BrowserBridge inherits abstract JavaBridge. Its role is to stand between the Java implementation and the native browser receiving commands, translating them to actions and returning the result. Browser bridge should be able to execute in its own thread as the main thread needs to run the Qt application. |
| 53 | * The structure of commands and responses mimics that of the Java part. |
| 54 | * Four commands should be implemented - load, grab page, mouse and keyboard. Two more should be added in the future - get info and resize. |
| 55 | * Load - gets a url as parameter. Executed on the Browser object it causes a page to be loaded and exits without blocking. This means that the Java application should use some other way to ensure that the page is loaded, for instance use the get info command. The result from this command is either Ok or Error. |
| 56 | * Grab page - executed on the Browser object. The result from this command is either PageGrabResponse or Error. PageGrabResponse contains image width, height and data. |
| 57 | * Mouse - executed on the BrowserWebView. Transfers a Java mouse event to the web view. Result is Ok or Error. |
| 58 | * Keyboard - executed on the BrowserWebView. Transfers a Java keyboard event to the web view. Result is Ok or Error. |
| 59 | |
| 60 | ---- |
| 61 | |
| 62 | [[BR]][[BR]] |
| 63 | A test has been added - NativeBrowserBridgeTest, change set: []. |