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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void SystemDragEnded(); | 68 void SystemDragEnded(); |
69 | 69 |
70 // Used to handle special keyboard events. | 70 // Used to handle special keyboard events. |
71 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 71 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
72 | 72 |
73 // Find the given |search_text| in the page. Returns true if the find request | 73 // Find the given |search_text| in the page. Returns true if the find request |
74 // is handled by this browser plugin embedder. | 74 // is handled by this browser plugin embedder. |
75 bool Find(int request_id, | 75 bool Find(int request_id, |
76 const base::string16& search_text, | 76 const base::string16& search_text, |
77 const blink::WebFindOptions& options); | 77 const blink::WebFindOptions& options); |
| 78 bool StopFinding(StopFindAction action); |
78 | 79 |
79 private: | 80 private: |
80 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); | 81 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
81 | 82 |
82 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 83 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
83 | 84 |
84 void ClearGuestDragStateIfApplicable(); | 85 void ClearGuestDragStateIfApplicable(); |
85 | 86 |
86 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); | 87 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); |
87 | 88 |
88 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 89 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
89 WebContents* guest); | 90 WebContents* guest); |
90 | 91 |
91 static bool FindInGuest(int request_id, | 92 static bool FindInGuest(int request_id, |
92 const base::string16& search_text, | 93 const base::string16& search_text, |
93 const blink::WebFindOptions& options, | 94 const blink::WebFindOptions& options, |
94 WebContents* guest); | 95 WebContents* guest); |
| 96 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); |
| 97 |
95 // Message handlers. | 98 // Message handlers. |
96 void OnAttach(int instance_id, | 99 void OnAttach(int instance_id, |
97 const BrowserPluginHostMsg_Attach_Params& params); | 100 const BrowserPluginHostMsg_Attach_Params& params); |
98 void OnPluginAtPositionResponse(int instance_id, | 101 void OnPluginAtPositionResponse(int instance_id, |
99 int request_id, | 102 int request_id, |
100 const gfx::Point& position); | 103 const gfx::Point& position); |
101 | 104 |
102 // Used to correctly update the cursor when dragging over a guest, and to | 105 // Used to correctly update the cursor when dragging over a guest, and to |
103 // handle a race condition when dropping onto the guest that started the drag | 106 // handle a race condition when dropping onto the guest that started the drag |
104 // (the race is that the dragend message arrives before the drop message so | 107 // (the race is that the dragend message arrives before the drop message so |
105 // the drop never takes place). | 108 // the drop never takes place). |
106 // crbug.com/233571 | 109 // crbug.com/233571 |
107 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; | 110 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; |
108 | 111 |
109 // Pointer to the guest that started the drag, used to forward necessary drag | 112 // Pointer to the guest that started the drag, used to forward necessary drag |
110 // status messages to the correct guest. | 113 // status messages to the correct guest. |
111 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; | 114 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; |
112 | 115 |
113 // Keeps track of "dragend" state. | 116 // Keeps track of "dragend" state. |
114 bool guest_drag_ending_; | 117 bool guest_drag_ending_; |
115 | 118 |
116 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 119 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
117 | 120 |
118 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 121 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
119 }; | 122 }; |
120 | 123 |
121 } // namespace content | 124 } // namespace content |
122 | 125 |
123 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 126 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |