| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // below so that the transient parent is visible to WindowTreeClient. | 475 // below so that the transient parent is visible to WindowTreeClient. |
| 476 // This fixes crbug.com/328593. | 476 // This fixes crbug.com/328593. |
| 477 if (transient_window_client) { | 477 if (transient_window_client) { |
| 478 transient_window_client->AddTransientChild( | 478 transient_window_client->AddTransientChild( |
| 479 popup_parent_host_view_->window_, window_); | 479 popup_parent_host_view_->window_, window_); |
| 480 } | 480 } |
| 481 | 481 |
| 482 aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); | 482 aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); |
| 483 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); | 483 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); |
| 484 | 484 |
| 485 SetBounds(bounds_in_screen); | 485 RequestTopLevelBoundsInScreen(bounds_in_screen); |
| 486 Show(); | 486 Show(); |
| 487 if (NeedsMouseCapture()) | 487 if (NeedsMouseCapture()) |
| 488 window_->SetCapture(); | 488 window_->SetCapture(); |
| 489 | 489 |
| 490 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); | 490 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); |
| 491 | 491 |
| 492 const display::Display display = | 492 const display::Display display = |
| 493 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); | 493 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
| 494 device_scale_factor_ = display.device_scale_factor(); | 494 device_scale_factor_ = display.device_scale_factor(); |
| 495 } | 495 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 return window_->GetToplevelWindow(); | 589 return window_->GetToplevelWindow(); |
| 590 } | 590 } |
| 591 | 591 |
| 592 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 592 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 593 // For a SetSize operation, we don't care what coordinate system the origin | 593 // For a SetSize operation, we don't care what coordinate system the origin |
| 594 // of the window is in, it's only important to make sure that the origin | 594 // of the window is in, it's only important to make sure that the origin |
| 595 // remains constant after the operation. | 595 // remains constant after the operation. |
| 596 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 596 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { | 599 void RenderWidgetHostViewAura::RequestTopLevelBoundsInScreen( |
| 600 const gfx::Rect& rect) { |
| 600 display::Display display = | 601 display::Display display = |
| 601 popup_parent_host_view_ | 602 popup_parent_host_view_ |
| 602 ? display::Screen::GetScreen()->GetDisplayNearestWindow( | 603 ? display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 603 popup_parent_host_view_->window_) | 604 popup_parent_host_view_->window_) |
| 604 : display::Screen::GetScreen()->GetDisplayMatching(rect); | 605 : display::Screen::GetScreen()->GetDisplayMatching(rect); |
| 605 GetToplevelWindow()->SetBoundsInScreen(rect, display); | 606 GetToplevelWindow()->SetBoundsInScreen(rect, display); |
| 606 } | 607 } |
| 607 | 608 |
| 608 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { | 609 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { |
| 609 return last_scroll_offset_; | 610 return last_scroll_offset_; |
| (...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 | 2381 |
| 2381 void RenderWidgetHostViewAura::SetPopupChild( | 2382 void RenderWidgetHostViewAura::SetPopupChild( |
| 2382 RenderWidgetHostViewAura* popup_child_host_view) { | 2383 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2383 popup_child_host_view_ = popup_child_host_view; | 2384 popup_child_host_view_ = popup_child_host_view; |
| 2384 event_handler_->SetPopupChild( | 2385 event_handler_->SetPopupChild( |
| 2385 popup_child_host_view, | 2386 popup_child_host_view, |
| 2386 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2387 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2387 } | 2388 } |
| 2388 | 2389 |
| 2389 } // namespace content | 2390 } // namespace content |
| OLD | NEW |