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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); | 44 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); |
45 | 45 |
46 // Returns this embedder's WebContentsImpl. | 46 // Returns this embedder's WebContentsImpl. |
47 WebContentsImpl* GetWebContents() const; | 47 WebContentsImpl* GetWebContents() const; |
48 | 48 |
49 // Called when embedder's |rwh| has sent screen rects to renderer. | 49 // Called when embedder's |rwh| has sent screen rects to renderer. |
50 void DidSendScreenRects(); | 50 void DidSendScreenRects(); |
51 | 51 |
52 // WebContentsObserver implementation. | 52 // WebContentsObserver implementation. |
53 bool OnMessageReceived(const IPC::Message& message) override; | 53 bool OnMessageReceived(const IPC::Message& message) override; |
| 54 bool OnMessageReceived(const IPC::Message& message, |
| 55 RenderFrameHost* render_frame_host) override; |
54 | 56 |
55 void DragSourceEndedAt(int client_x, int client_y, int screen_x, | 57 void DragSourceEndedAt(int client_x, int client_y, int screen_x, |
56 int screen_y, blink::WebDragOperation operation); | 58 int screen_y, blink::WebDragOperation operation); |
57 | 59 |
58 void OnUpdateDragCursor(bool* handled); | 60 void OnUpdateDragCursor(bool* handled); |
59 | 61 |
60 void DragEnteredGuest(BrowserPluginGuest* guest); | 62 void DragEnteredGuest(BrowserPluginGuest* guest); |
61 | 63 |
62 void DragLeftGuest(BrowserPluginGuest* guest); | 64 void DragLeftGuest(BrowserPluginGuest* guest); |
63 | 65 |
(...skipping 25 matching lines...) Expand all Loading... |
89 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 91 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
90 WebContents* guest); | 92 WebContents* guest); |
91 | 93 |
92 static bool FindInGuest(int request_id, | 94 static bool FindInGuest(int request_id, |
93 const base::string16& search_text, | 95 const base::string16& search_text, |
94 const blink::WebFindOptions& options, | 96 const blink::WebFindOptions& options, |
95 WebContents* guest); | 97 WebContents* guest); |
96 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); | 98 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); |
97 | 99 |
98 // Message handlers. | 100 // Message handlers. |
99 void OnAttach(int instance_id, | 101 void OnAttach(RenderFrameHost* render_frame_host, |
| 102 int instance_id, |
100 const BrowserPluginHostMsg_Attach_Params& params); | 103 const BrowserPluginHostMsg_Attach_Params& params); |
101 void OnPluginAtPositionResponse(int instance_id, | 104 void OnPluginAtPositionResponse(int instance_id, |
102 int request_id, | 105 int request_id, |
103 const gfx::Point& position); | 106 const gfx::Point& position); |
104 | 107 |
105 // Used to correctly update the cursor when dragging over a guest, and to | 108 // Used to correctly update the cursor when dragging over a guest, and to |
106 // handle a race condition when dropping onto the guest that started the drag | 109 // handle a race condition when dropping onto the guest that started the drag |
107 // (the race is that the dragend message arrives before the drop message so | 110 // (the race is that the dragend message arrives before the drop message so |
108 // the drop never takes place). | 111 // the drop never takes place). |
109 // crbug.com/233571 | 112 // crbug.com/233571 |
110 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; | 113 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; |
111 | 114 |
112 // Pointer to the guest that started the drag, used to forward necessary drag | 115 // Pointer to the guest that started the drag, used to forward necessary drag |
113 // status messages to the correct guest. | 116 // status messages to the correct guest. |
114 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; | 117 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; |
115 | 118 |
116 // Keeps track of "dragend" state. | 119 // Keeps track of "dragend" state. |
117 bool guest_drag_ending_; | 120 bool guest_drag_ending_; |
118 | 121 |
119 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 122 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
120 | 123 |
121 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 124 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
122 }; | 125 }; |
123 | 126 |
124 } // namespace content | 127 } // namespace content |
125 | 128 |
126 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 129 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |