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