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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 // |guest|. This |guest| will be signaled at the end of the drag operation. | 60 // |guest|. This |guest| will be signaled at the end of the drag operation. |
61 void StartDrag(BrowserPluginGuest* guest); | 61 void StartDrag(BrowserPluginGuest* guest); |
62 | 62 |
63 // Sends EndSystemDrag message to the guest that initiated the last drag/drop | 63 // Sends EndSystemDrag message to the guest that initiated the last drag/drop |
64 // operation, if there's any. | 64 // operation, if there's any. |
65 void SystemDragEnded(); | 65 void SystemDragEnded(); |
66 | 66 |
67 // Used to handle special keyboard events. | 67 // Used to handle special keyboard events. |
68 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 68 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
69 | 69 |
70 // Find the given |search_text| in the page. Returns true if the find request | 70 BrowserPluginGuest* GetFullPageGuest(); |
Sam McNally
2015/04/01 06:04:49
Comment?
raymes
2015/04/13 11:00:31
Done.
| |
71 // is handled by this browser plugin embedder. | |
72 bool Find(int request_id, | |
73 const base::string16& search_text, | |
74 const blink::WebFindOptions& options); | |
75 bool StopFinding(StopFindAction action); | |
76 | 71 |
77 private: | 72 private: |
78 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); | 73 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
79 | 74 |
80 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 75 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
81 | 76 |
82 void ClearGuestDragStateIfApplicable(); | 77 void ClearGuestDragStateIfApplicable(); |
83 | 78 |
84 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); | 79 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); |
85 | 80 |
86 // Notifies a guest that the embedder's screen info has changed. | 81 // Notifies a guest that the embedder's screen info has changed. |
87 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); | 82 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); |
88 | 83 |
89 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 84 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
90 WebContents* guest); | 85 WebContents* guest); |
91 | 86 |
92 static bool FindInGuest(int request_id, | |
93 const base::string16& search_text, | |
94 const blink::WebFindOptions& options, | |
95 WebContents* guest); | |
96 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); | |
97 | |
98 // Message handlers. | 87 // Message handlers. |
99 | 88 |
100 void OnAttach(RenderFrameHost* render_frame_host, | 89 void OnAttach(RenderFrameHost* render_frame_host, |
101 int instance_id, | 90 int instance_id, |
102 const BrowserPluginHostMsg_Attach_Params& params); | 91 const BrowserPluginHostMsg_Attach_Params& params); |
103 void OnUpdateDragCursor(bool* handled); | 92 void OnUpdateDragCursor(bool* handled); |
104 | 93 |
105 // Used to correctly update the cursor when dragging over a guest, and to | 94 // 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 | 95 // 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 | 96 // (the race is that the dragend message arrives before the drop message so |
108 // the drop never takes place). | 97 // the drop never takes place). |
109 // crbug.com/233571 | 98 // crbug.com/233571 |
110 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; | 99 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; |
111 | 100 |
112 // Pointer to the guest that started the drag, used to forward necessary drag | 101 // Pointer to the guest that started the drag, used to forward necessary drag |
113 // status messages to the correct guest. | 102 // status messages to the correct guest. |
114 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; | 103 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; |
115 | 104 |
116 // Keeps track of "dragend" state. | 105 // Keeps track of "dragend" state. |
117 bool guest_drag_ending_; | 106 bool guest_drag_ending_; |
118 | 107 |
119 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 108 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
120 | 109 |
121 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 110 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
122 }; | 111 }; |
123 | 112 |
124 } // namespace content | 113 } // namespace content |
125 | 114 |
126 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 115 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |