Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.cc

Issue 853333002: Browser Plugin: Make aware of focus direction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 5 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" 8 #include "content/browser/browser_plugin/browser_plugin_guest.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // DragSourceEndedAt() first. For this reason, we check if both methods were 75 // DragSourceEndedAt() first. For this reason, we check if both methods were
76 // called before resetting |guest_started_drag_|. 76 // called before resetting |guest_started_drag_|.
77 if (guest_drag_ending_) { 77 if (guest_drag_ending_) {
78 if (guest_started_drag_) 78 if (guest_started_drag_)
79 guest_started_drag_.reset(); 79 guest_started_drag_.reset();
80 } else { 80 } else {
81 guest_drag_ending_ = true; 81 guest_drag_ending_ = true;
82 } 82 }
83 } 83 }
84 84
85 // static
85 bool BrowserPluginEmbedder::DidSendScreenRectsCallback( 86 bool BrowserPluginEmbedder::DidSendScreenRectsCallback(
86 WebContents* guest_web_contents) { 87 WebContents* guest_web_contents) {
87 static_cast<RenderViewHostImpl*>( 88 static_cast<RenderViewHostImpl*>(
88 guest_web_contents->GetRenderViewHost())->SendScreenRects(); 89 guest_web_contents->GetRenderViewHost())->SendScreenRects();
89 // Not handled => Iterate over all guests. 90 // Not handled => Iterate over all guests.
90 return false; 91 return false;
91 } 92 }
92 93
93 void BrowserPluginEmbedder::DidSendScreenRects() { 94 void BrowserPluginEmbedder::DidSendScreenRects() {
94 GetBrowserPluginGuestManager()->ForEachGuest( 95 GetBrowserPluginGuestManager()->ForEachGuest(
95 GetWebContents(), base::Bind( 96 GetWebContents(), base::Bind(
96 &BrowserPluginEmbedder::DidSendScreenRectsCallback, 97 &BrowserPluginEmbedder::DidSendScreenRectsCallback));
97 base::Unretained(this)));
98 } 98 }
99 99
100 bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) { 100 bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
101 bool handled = true; 101 bool handled = true;
102 IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message) 102 IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message)
103 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach) 103 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach)
104 IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor, 104 IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor,
105 OnUpdateDragCursor(&handled)); 105 OnUpdateDragCursor(&handled));
106 IPC_MESSAGE_UNHANDLED(handled = false) 106 IPC_MESSAGE_UNHANDLED(handled = false)
107 IPC_END_MESSAGE_MAP() 107 IPC_END_MESSAGE_MAP()
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 const NativeWebKeyboardEvent& event) { 150 const NativeWebKeyboardEvent& event) {
151 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) || 151 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) ||
152 (event.modifiers & blink::WebInputEvent::InputModifiers)) { 152 (event.modifiers & blink::WebInputEvent::InputModifiers)) {
153 return false; 153 return false;
154 } 154 }
155 155
156 bool event_consumed = false; 156 bool event_consumed = false;
157 GetBrowserPluginGuestManager()->ForEachGuest( 157 GetBrowserPluginGuestManager()->ForEachGuest(
158 GetWebContents(), 158 GetWebContents(),
159 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, 159 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback,
160 base::Unretained(this),
161 &event_consumed)); 160 &event_consumed));
162 161
163 return event_consumed; 162 return event_consumed;
164 } 163 }
165 164
166 bool BrowserPluginEmbedder::Find(int request_id, 165 bool BrowserPluginEmbedder::Find(int request_id,
167 const base::string16& search_text, 166 const base::string16& search_text,
168 const blink::WebFindOptions& options) { 167 const blink::WebFindOptions& options) {
169 return GetBrowserPluginGuestManager()->ForEachGuest( 168 return GetBrowserPluginGuestManager()->ForEachGuest(
170 GetWebContents(), 169 GetWebContents(),
171 base::Bind(&BrowserPluginEmbedder::FindInGuest, 170 base::Bind(&BrowserPluginEmbedder::FindInGuest,
172 base::Unretained(this),
173 request_id, 171 request_id,
174 search_text, 172 search_text,
175 options)); 173 options));
176 } 174 }
177 175
176 // static
178 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, 177 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked,
179 WebContents* guest) { 178 WebContents* guest) {
180 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) 179 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest)
181 ->GetBrowserPluginGuest() 180 ->GetBrowserPluginGuest()
182 ->mouse_locked(); 181 ->mouse_locked();
183 guest->GotResponseToLockMouseRequest(false); 182 guest->GotResponseToLockMouseRequest(false);
184 183
185 // Returns false to iterate over all guests. 184 // Returns false to iterate over all guests.
186 return false; 185 return false;
187 } 186 }
188 187
188 // static
189 bool BrowserPluginEmbedder::FindInGuest(int request_id, 189 bool BrowserPluginEmbedder::FindInGuest(int request_id,
190 const base::string16& search_text, 190 const base::string16& search_text,
191 const blink::WebFindOptions& options, 191 const blink::WebFindOptions& options,
192 WebContents* guest) { 192 WebContents* guest) {
193 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find( 193 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find(
194 request_id, search_text, options)) { 194 request_id, search_text, options)) {
195 // There can only ever currently be one browser plugin that handles find so 195 // There can only ever currently be one browser plugin that handles find so
196 // we can break the iteration at this point. 196 // we can break the iteration at this point.
197 return true; 197 return true;
198 } 198 }
199 return false; 199 return false;
200 } 200 }
201 201
202 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_embedder.h ('k') | content/browser/browser_plugin/browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698