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