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

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

Issue 511643002: BrowserPlugin: Simplify guest access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (guest_started_drag_) 125 if (guest_started_drag_)
126 guest_started_drag_->EndSystemDrag(); 126 guest_started_drag_->EndSystemDrag();
127 guest_dragging_over_.reset(); 127 guest_dragging_over_.reset();
128 ClearGuestDragStateIfApplicable(); 128 ClearGuestDragStateIfApplicable();
129 } 129 }
130 130
131 void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) { 131 void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) {
132 *handled = (guest_dragging_over_.get() != NULL); 132 *handled = (guest_dragging_over_.get() != NULL);
133 } 133 }
134 134
135 void BrowserPluginEmbedder::OnGuestCallback(
136 int browser_plugin_instance_id,
137 const BrowserPluginHostMsg_Attach_Params& params,
138 WebContents* guest_web_contents) {
139 BrowserPluginGuest* guest = guest_web_contents ?
140 static_cast<WebContentsImpl*>(guest_web_contents)->
141 GetBrowserPluginGuest() : NULL;
142 if (guest)
143 guest->Attach(browser_plugin_instance_id, GetWebContents(), params);
144 }
145
146 void BrowserPluginEmbedder::OnAttach( 135 void BrowserPluginEmbedder::OnAttach(
147 int browser_plugin_instance_id, 136 int browser_plugin_instance_id,
148 const BrowserPluginHostMsg_Attach_Params& params) { 137 const BrowserPluginHostMsg_Attach_Params& params) {
149 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( 138 WebContents* guest_web_contents =
150 web_contents(), 139 GetBrowserPluginGuestManager()->GetGuestByInstanceID(
151 browser_plugin_instance_id, 140 GetWebContents(), browser_plugin_instance_id);
152 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, 141 if (!guest_web_contents)
153 base::Unretained(this), 142 return;
154 browser_plugin_instance_id, 143 BrowserPluginGuest* guest = static_cast<WebContentsImpl*>(guest_web_contents)
155 params)); 144 ->GetBrowserPluginGuest();
145 guest->Attach(browser_plugin_instance_id, GetWebContents(), params);
156 } 146 }
157 147
158 bool BrowserPluginEmbedder::HandleKeyboardEvent( 148 bool BrowserPluginEmbedder::HandleKeyboardEvent(
159 const NativeWebKeyboardEvent& event) { 149 const NativeWebKeyboardEvent& event) {
160 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) || 150 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) ||
161 (event.modifiers & blink::WebInputEvent::InputModifiers)) { 151 (event.modifiers & blink::WebInputEvent::InputModifiers)) {
162 return false; 152 return false;
163 } 153 }
164 154
165 bool event_consumed = false; 155 bool event_consumed = false;
(...skipping 11 matching lines...) Expand all
177 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) 167 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest)
178 ->GetBrowserPluginGuest() 168 ->GetBrowserPluginGuest()
179 ->mouse_locked(); 169 ->mouse_locked();
180 guest->GotResponseToLockMouseRequest(false); 170 guest->GotResponseToLockMouseRequest(false);
181 171
182 // Returns false to iterate over all guests. 172 // Returns false to iterate over all guests.
183 return false; 173 return false;
184 } 174 }
185 175
186 } // namespace content 176 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698