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

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

Issue 354483004: Implement <appview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_view_skeleton
Patch Set: Fixed formatting Created 6 years, 5 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_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 BrowserPluginGuestManager* 286 BrowserPluginGuestManager*
287 BrowserPluginGuest::GetBrowserPluginGuestManager() const { 287 BrowserPluginGuest::GetBrowserPluginGuestManager() const {
288 return GetWebContents()->GetBrowserContext()->GetGuestManager(); 288 return GetWebContents()->GetBrowserContext()->GetGuestManager();
289 } 289 }
290 290
291 // screen. 291 // screen.
292 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) { 292 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) {
293 gfx::Rect guest_rect(bounds); 293 gfx::Rect guest_rect(bounds);
294 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin()); 294 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin());
295 if (embedder_web_contents()->GetBrowserPluginGuest()) {
296 BrowserPluginGuest* embedder_guest =
297 embedder_web_contents()->GetBrowserPluginGuest();
298 guest_rect.Offset(embedder_guest->guest_window_rect_.OffsetFromOrigin());
299 }
295 return guest_rect; 300 return guest_rect;
296 } 301 }
297 302
298 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { 303 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) {
299 embedder_visible_ = visible; 304 embedder_visible_ = visible;
300 UpdateVisibility(); 305 UpdateVisibility();
301 } 306 }
302 307
303 void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) { 308 void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) {
304 SendMessageToEmbedder( 309 SendMessageToEmbedder(
305 new BrowserPluginMsg_SetMouseLock(instance_id(), allow)); 310 new BrowserPluginMsg_SetMouseLock(instance_id(), allow));
306 } 311 }
307 312
308 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { 313 WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
309 return static_cast<WebContentsImpl*>(web_contents()); 314 return static_cast<WebContentsImpl*>(web_contents());
310 } 315 }
311 316
312 gfx::Point BrowserPluginGuest::GetScreenCoordinates( 317 gfx::Point BrowserPluginGuest::GetScreenCoordinates(
313 const gfx::Point& relative_position) const { 318 const gfx::Point& relative_position) const {
319 if (!attached())
320 return relative_position;
321
314 gfx::Point screen_pos(relative_position); 322 gfx::Point screen_pos(relative_position);
315 screen_pos += guest_window_rect_.OffsetFromOrigin(); 323 screen_pos += guest_window_rect_.OffsetFromOrigin();
324 if (embedder_web_contents()->GetBrowserPluginGuest()) {
325 BrowserPluginGuest* embedder_guest =
326 embedder_web_contents()->GetBrowserPluginGuest();
327 screen_pos += embedder_guest->guest_window_rect_.OffsetFromOrigin();
328 }
316 return screen_pos; 329 return screen_pos;
317 } 330 }
318 331
319 bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const { 332 bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const {
320 return size.width() <= max_auto_size_.width() && 333 return size.width() <= max_auto_size_.width() &&
321 size.height() <= max_auto_size_.height(); 334 size.height() <= max_auto_size_.height();
322 } 335 }
323 336
324 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { 337 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
325 if (!attached()) { 338 if (!attached()) {
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 void BrowserPluginGuest::OnImeCompositionRangeChanged( 889 void BrowserPluginGuest::OnImeCompositionRangeChanged(
877 const gfx::Range& range, 890 const gfx::Range& range,
878 const std::vector<gfx::Rect>& character_bounds) { 891 const std::vector<gfx::Rect>& character_bounds) {
879 static_cast<RenderWidgetHostViewBase*>( 892 static_cast<RenderWidgetHostViewBase*>(
880 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 893 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
881 range, character_bounds); 894 range, character_bounds);
882 } 895 }
883 #endif 896 #endif
884 897
885 } // namespace content 898 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/shim/test.js ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698