| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's | 5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's |
| 6 // embedder that are not directed at any particular existing guest process. | 6 // embedder that are not directed at any particular existing guest process. |
| 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer | 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer |
| 8 // process requests an initial navigation, the WebContents for that renderer | 8 // process requests an initial navigation, the WebContents for that renderer |
| 9 // renderer creates a BrowserPluginEmbedder for itself. The | 9 // renderer creates a BrowserPluginEmbedder for itself. The |
| 10 // BrowserPluginEmbedder, in turn, forwards the requests to a | 10 // BrowserPluginEmbedder, in turn, forwards the requests to a |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 void StartDrag(BrowserPluginGuest* guest); | 80 void StartDrag(BrowserPluginGuest* guest); |
| 81 | 81 |
| 82 // Sends EndSystemDrag message to the guest that initiated the last drag/drop | 82 // Sends EndSystemDrag message to the guest that initiated the last drag/drop |
| 83 // operation, if there's any. | 83 // operation, if there's any. |
| 84 void SystemDragEnded(); | 84 void SystemDragEnded(); |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 friend class TestBrowserPluginEmbedder; | 87 friend class TestBrowserPluginEmbedder; |
| 88 | 88 |
| 89 BrowserPluginEmbedder(WebContentsImpl* web_contents); | 89 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
| 90 | |
| 91 BrowserPluginGuestManager* GetBrowserPluginGuestManager(); | |
| 92 | 90 |
| 93 bool DidSendScreenRectsCallback(BrowserPluginGuest* guest); | 91 bool DidSendScreenRectsCallback(BrowserPluginGuest* guest); |
| 94 | 92 |
| 95 bool SetZoomLevelCallback(double level, BrowserPluginGuest* guest); | 93 bool SetZoomLevelCallback(double level, BrowserPluginGuest* guest); |
| 96 | 94 |
| 97 bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event, | 95 bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event, |
| 98 BrowserPluginGuest* guest); | 96 BrowserPluginGuest* guest); |
| 99 | 97 |
| 98 void AllocateInstanceIDResponse(int request_id, int instance_id); |
| 99 |
| 100 // Message handlers. | 100 // Message handlers. |
| 101 | 101 |
| 102 void OnAllocateInstanceID(int request_id); | 102 void OnAllocateInstanceID(int request_id, const std::string& src); |
| 103 void OnAttach(int instance_id, | 103 void OnAttach(int instance_id, |
| 104 const BrowserPluginHostMsg_Attach_Params& params, | 104 const BrowserPluginHostMsg_Attach_Params& params, |
| 105 const base::DictionaryValue& extra_params); | 105 const base::DictionaryValue& extra_params); |
| 106 void OnPluginAtPositionResponse(int instance_id, | 106 void OnPluginAtPositionResponse(int instance_id, |
| 107 int request_id, | 107 int request_id, |
| 108 const gfx::Point& position); | 108 const gfx::Point& position); |
| 109 | 109 |
| 110 // Static factory instance (always NULL for non-test). | 110 // Static factory instance (always NULL for non-test). |
| 111 static BrowserPluginHostFactory* factory_; | 111 static BrowserPluginHostFactory* factory_; |
| 112 | 112 |
| 113 // Used to correctly update the cursor when dragging over a guest, and to | 113 // Used to correctly update the cursor when dragging over a guest, and to |
| 114 // handle a race condition when dropping onto the guest that started the drag | 114 // handle a race condition when dropping onto the guest that started the drag |
| 115 // (the race is that the dragend message arrives before the drop message so | 115 // (the race is that the dragend message arrives before the drop message so |
| 116 // the drop never takes place). | 116 // the drop never takes place). |
| 117 // crbug.com/233571 | 117 // crbug.com/233571 |
| 118 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; | 118 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; |
| 119 | 119 |
| 120 // Pointer to the guest that started the drag, used to forward necessary drag | 120 // Pointer to the guest that started the drag, used to forward necessary drag |
| 121 // status messages to the correct guest. | 121 // status messages to the correct guest. |
| 122 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; | 122 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; |
| 123 | 123 |
| 124 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
| 125 |
| 124 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 126 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
| 125 }; | 127 }; |
| 126 | 128 |
| 127 } // namespace content | 129 } // namespace content |
| 128 | 130 |
| 129 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 131 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| OLD | NEW |