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 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 return static_cast<gfx::NativeViewId>(NULL); | 439 return static_cast<gfx::NativeViewId>(NULL); |
440 #endif | 440 #endif |
441 } | 441 } |
442 | 442 |
443 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { | 443 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { |
444 NOTIMPLEMENTED(); | 444 NOTIMPLEMENTED(); |
445 return static_cast<gfx::NativeViewAccessible>(NULL); | 445 return static_cast<gfx::NativeViewAccessible>(NULL); |
446 } | 446 } |
447 | 447 |
448 void RenderWidgetHostViewAura::MovePluginWindows( | 448 void RenderWidgetHostViewAura::MovePluginWindows( |
449 const gfx::Point& scroll_offset, | 449 const gfx::Vector2d& scroll_offset, |
450 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { | 450 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { |
451 #if defined(OS_WIN) | 451 #if defined(OS_WIN) |
452 // We need to clip the rectangle to the tab's viewport, otherwise we will draw | 452 // We need to clip the rectangle to the tab's viewport, otherwise we will draw |
453 // over the browser UI. | 453 // over the browser UI. |
454 if (!window_->GetRootWindow()) { | 454 if (!window_->GetRootWindow()) { |
455 DCHECK(plugin_window_moves.empty()); | 455 DCHECK(plugin_window_moves.empty()); |
456 return; | 456 return; |
457 } | 457 } |
458 HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); | 458 HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); |
459 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); | 459 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); |
460 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves; | 460 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves; |
461 | 461 |
462 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), | 462 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), |
463 view_bounds.height()); | 463 view_bounds.height()); |
464 | 464 |
465 for (size_t i = 0; i < moves.size(); ++i) { | 465 for (size_t i = 0; i < moves.size(); ++i) { |
466 gfx::Rect clip = moves[i].clip_rect; | 466 gfx::Rect clip = moves[i].clip_rect; |
467 clip.Offset(moves[i].window_rect.origin()); | 467 clip.Offset(moves[i].window_rect.OffsetFromOrigin()); |
Peter Kasting
2012/10/30 01:14:14
Nit: Combine these two Offset() calls (2 places)
| |
468 clip.Offset(scroll_offset); | 468 clip.Offset(scroll_offset); |
469 clip.Intersect(view_port); | 469 clip.Intersect(view_port); |
470 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y()); | 470 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y()); |
Peter Kasting
2012/10/30 01:14:14
Nit: -moves[i].window_rect.OffsetFromOrigin()
| |
471 clip.Offset(-scroll_offset.x(), -scroll_offset.y()); | 471 clip.Offset(-scroll_offset); |
472 moves[i].clip_rect = clip; | 472 moves[i].clip_rect = clip; |
473 | 473 |
474 moves[i].window_rect.Offset(view_bounds.origin()); | 474 moves[i].window_rect.Offset(view_bounds.OffsetFromOrigin()); |
475 } | 475 } |
476 MovePluginWindowsHelper(parent, moves); | 476 MovePluginWindowsHelper(parent, moves); |
477 | 477 |
478 // Make sure each plugin window (or its wrapper if it exists) has a pointer to | 478 // Make sure each plugin window (or its wrapper if it exists) has a pointer to |
479 // |this|. | 479 // |this|. |
480 for (size_t i = 0; i < moves.size(); ++i) { | 480 for (size_t i = 0; i < moves.size(); ++i) { |
481 HWND window = moves[i].window; | 481 HWND window = moves[i].window; |
482 if (GetParent(window) != parent) { | 482 if (GetParent(window) != parent) { |
483 window = GetParent(window); | 483 window = GetParent(window); |
484 DCHECK(GetParent(window) == parent); | 484 DCHECK(GetParent(window) == parent); |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1918 RenderWidgetHost* widget) { | 1918 RenderWidgetHost* widget) { |
1919 return new RenderWidgetHostViewAura(widget); | 1919 return new RenderWidgetHostViewAura(widget); |
1920 } | 1920 } |
1921 | 1921 |
1922 // static | 1922 // static |
1923 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1923 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1924 GetScreenInfoForWindow(results, NULL); | 1924 GetScreenInfoForWindow(results, NULL); |
1925 } | 1925 } |
1926 | 1926 |
1927 } // namespace content | 1927 } // namespace content |
OLD | NEW |