| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 579 } |
| 580 #endif | 580 #endif |
| 581 } | 581 } |
| 582 | 582 |
| 583 #if defined(OS_WIN) | 583 #if defined(OS_WIN) |
| 584 if (legacy_render_widget_host_HWND_) | 584 if (legacy_render_widget_host_HWND_) |
| 585 legacy_render_widget_host_HWND_->Hide(); | 585 legacy_render_widget_host_HWND_->Hide(); |
| 586 #endif | 586 #endif |
| 587 } | 587 } |
| 588 | 588 |
| 589 aura::Window* RenderWidgetHostViewAura::GetToplevelWindow() { | |
| 590 return window_->GetToplevelWindow(); | |
| 591 } | |
| 592 | |
| 593 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 589 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 594 // For a SetSize operation, we don't care what coordinate system the origin | 590 // For a SetSize operation, we don't care what coordinate system the origin |
| 595 // of the window is in, it's only important to make sure that the origin | 591 // of the window is in, it's only important to make sure that the origin |
| 596 // remains constant after the operation. | 592 // remains constant after the operation. |
| 597 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 593 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 598 } | 594 } |
| 599 | 595 |
| 600 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { | 596 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { |
| 601 display::Display display = | 597 gfx::Point relative_origin(rect.origin()); |
| 602 popup_parent_host_view_ | 598 |
| 603 ? display::Screen::GetScreen()->GetDisplayNearestWindow( | 599 // RenderWidgetHostViewAura::SetBounds() takes screen coordinates, but |
| 604 popup_parent_host_view_->window_) | 600 // Window::SetBounds() takes parent coordinates, so do the conversion here. |
| 605 : display::Screen::GetScreen()->GetDisplayMatching(rect); | 601 aura::Window* root = window_->GetRootWindow(); |
| 606 GetToplevelWindow()->SetBoundsInScreen(rect, display); | 602 if (root) { |
| 603 aura::client::ScreenPositionClient* screen_position_client = |
| 604 aura::client::GetScreenPositionClient(root); |
| 605 if (screen_position_client) { |
| 606 screen_position_client->ConvertPointFromScreen(window_->parent(), |
| 607 &relative_origin); |
| 608 } |
| 609 } |
| 610 |
| 611 InternalSetBounds(gfx::Rect(relative_origin, rect.size())); |
| 607 } | 612 } |
| 608 | 613 |
| 609 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { | 614 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { |
| 610 return last_scroll_offset_; | 615 return last_scroll_offset_; |
| 611 } | 616 } |
| 612 | 617 |
| 613 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 618 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
| 614 return window_; | 619 return window_; |
| 615 } | 620 } |
| 616 | 621 |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 | 2374 |
| 2370 void RenderWidgetHostViewAura::SetPopupChild( | 2375 void RenderWidgetHostViewAura::SetPopupChild( |
| 2371 RenderWidgetHostViewAura* popup_child_host_view) { | 2376 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2372 popup_child_host_view_ = popup_child_host_view; | 2377 popup_child_host_view_ = popup_child_host_view; |
| 2373 event_handler_->SetPopupChild( | 2378 event_handler_->SetPopupChild( |
| 2374 popup_child_host_view, | 2379 popup_child_host_view, |
| 2375 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2380 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2376 } | 2381 } |
| 2377 | 2382 |
| 2378 } // namespace content | 2383 } // namespace content |
| OLD | NEW |