| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "ui/aura/window.h" | 69 #include "ui/aura/window.h" |
| 70 #include "ui/aura/window_event_dispatcher.h" | 70 #include "ui/aura/window_event_dispatcher.h" |
| 71 #include "ui/aura/window_observer.h" | 71 #include "ui/aura/window_observer.h" |
| 72 #include "ui/aura/window_tree_host.h" | 72 #include "ui/aura/window_tree_host.h" |
| 73 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 73 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 74 #include "ui/base/hit_test.h" | 74 #include "ui/base/hit_test.h" |
| 75 #include "ui/base/ime/input_method.h" | 75 #include "ui/base/ime/input_method.h" |
| 76 #include "ui/base/ui_base_types.h" | 76 #include "ui/base/ui_base_types.h" |
| 77 #include "ui/compositor/compositor_vsync_manager.h" | 77 #include "ui/compositor/compositor_vsync_manager.h" |
| 78 #include "ui/compositor/dip_util.h" | 78 #include "ui/compositor/dip_util.h" |
| 79 #include "ui/display/display.h" |
| 80 #include "ui/display/screen.h" |
| 79 #include "ui/events/blink/blink_event_util.h" | 81 #include "ui/events/blink/blink_event_util.h" |
| 80 #include "ui/events/event.h" | 82 #include "ui/events/event.h" |
| 81 #include "ui/events/event_utils.h" | 83 #include "ui/events/event_utils.h" |
| 82 #include "ui/events/gesture_detection/gesture_configuration.h" | 84 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 83 #include "ui/events/gestures/gesture_recognizer.h" | 85 #include "ui/events/gestures/gesture_recognizer.h" |
| 84 #include "ui/gfx/canvas.h" | 86 #include "ui/gfx/canvas.h" |
| 85 #include "ui/gfx/color_profile.h" | 87 #include "ui/gfx/color_profile.h" |
| 86 #include "ui/gfx/display.h" | |
| 87 #include "ui/gfx/geometry/dip_util.h" | 88 #include "ui/gfx/geometry/dip_util.h" |
| 88 #include "ui/gfx/geometry/rect_conversions.h" | 89 #include "ui/gfx/geometry/rect_conversions.h" |
| 89 #include "ui/gfx/geometry/size_conversions.h" | 90 #include "ui/gfx/geometry/size_conversions.h" |
| 90 #include "ui/gfx/screen.h" | |
| 91 #include "ui/gfx/skia_util.h" | 91 #include "ui/gfx/skia_util.h" |
| 92 #include "ui/touch_selection/touch_selection_controller.h" | 92 #include "ui/touch_selection/touch_selection_controller.h" |
| 93 #include "ui/wm/public/activation_client.h" | 93 #include "ui/wm/public/activation_client.h" |
| 94 #include "ui/wm/public/scoped_tooltip_disabler.h" | 94 #include "ui/wm/public/scoped_tooltip_disabler.h" |
| 95 #include "ui/wm/public/tooltip_client.h" | 95 #include "ui/wm/public/tooltip_client.h" |
| 96 #include "ui/wm/public/transient_window_client.h" | 96 #include "ui/wm/public/transient_window_client.h" |
| 97 #include "ui/wm/public/window_types.h" | 97 #include "ui/wm/public/window_types.h" |
| 98 | 98 |
| 99 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
| 100 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 100 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 switch (event->native_event().message) { | 162 switch (event->native_event().message) { |
| 163 case WM_XBUTTONUP: | 163 case WM_XBUTTONUP: |
| 164 case WM_NCXBUTTONUP: | 164 case WM_NCXBUTTONUP: |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 #endif | 167 #endif |
| 168 return false; | 168 return false; |
| 169 } | 169 } |
| 170 | 170 |
| 171 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { | 171 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { |
| 172 gfx::Screen* screen = gfx::Screen::GetScreen(); | 172 display::Screen* screen = display::Screen::GetScreen(); |
| 173 const gfx::Display display = window ? screen->GetDisplayNearestWindow(window) | 173 const display::Display display = window |
| 174 : screen->GetPrimaryDisplay(); | 174 ? screen->GetDisplayNearestWindow(window) |
| 175 : screen->GetPrimaryDisplay(); |
| 175 results->rect = display.bounds(); | 176 results->rect = display.bounds(); |
| 176 results->availableRect = display.work_area(); | 177 results->availableRect = display.work_area(); |
| 177 // TODO(derat|oshima): Don't hardcode this. Get this from display object. | 178 // TODO(derat|oshima): Don't hardcode this. Get this from display object. |
| 178 results->depth = 24; | 179 results->depth = 24; |
| 179 results->depthPerComponent = 8; | 180 results->depthPerComponent = 8; |
| 180 results->deviceScaleFactor = display.device_scale_factor(); | 181 results->deviceScaleFactor = display.device_scale_factor(); |
| 181 | 182 |
| 182 // The Display rotation and the WebScreenInfo orientation are not the same | 183 // The Display rotation and the WebScreenInfo orientation are not the same |
| 183 // angle. The former is the physical display rotation while the later is the | 184 // angle. The former is the physical display rotation while the later is the |
| 184 // rotation required by the content to be shown properly on the screen, in | 185 // rotation required by the content to be shown properly on the screen, in |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 gfx::NativeView parent_view) { | 427 gfx::NativeView parent_view) { |
| 427 CreateAuraWindow(); | 428 CreateAuraWindow(); |
| 428 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 429 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 429 window_->Init(ui::LAYER_SOLID_COLOR); | 430 window_->Init(ui::LAYER_SOLID_COLOR); |
| 430 window_->SetName("RenderWidgetHostViewAura"); | 431 window_->SetName("RenderWidgetHostViewAura"); |
| 431 window_->layer()->SetColor(background_color_); | 432 window_->layer()->SetColor(background_color_); |
| 432 | 433 |
| 433 if (parent_view) | 434 if (parent_view) |
| 434 parent_view->AddChild(GetNativeView()); | 435 parent_view->AddChild(GetNativeView()); |
| 435 | 436 |
| 436 const gfx::Display display = | 437 const display::Display display = |
| 437 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); | 438 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
| 438 device_scale_factor_ = display.device_scale_factor(); | 439 device_scale_factor_ = display.device_scale_factor(); |
| 439 } | 440 } |
| 440 | 441 |
| 441 void RenderWidgetHostViewAura::InitAsPopup( | 442 void RenderWidgetHostViewAura::InitAsPopup( |
| 442 RenderWidgetHostView* parent_host_view, | 443 RenderWidgetHostView* parent_host_view, |
| 443 const gfx::Rect& bounds_in_screen) { | 444 const gfx::Rect& bounds_in_screen) { |
| 444 CreateAuraWindow(); | 445 CreateAuraWindow(); |
| 445 popup_parent_host_view_ = | 446 popup_parent_host_view_ = |
| 446 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 447 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
| 447 | 448 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); | 480 aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); |
| 480 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); | 481 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); |
| 481 | 482 |
| 482 SetBounds(bounds_in_screen); | 483 SetBounds(bounds_in_screen); |
| 483 Show(); | 484 Show(); |
| 484 if (NeedsMouseCapture()) | 485 if (NeedsMouseCapture()) |
| 485 window_->SetCapture(); | 486 window_->SetCapture(); |
| 486 | 487 |
| 487 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); | 488 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); |
| 488 | 489 |
| 489 const gfx::Display display = | 490 const display::Display display = |
| 490 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); | 491 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
| 491 device_scale_factor_ = display.device_scale_factor(); | 492 device_scale_factor_ = display.device_scale_factor(); |
| 492 } | 493 } |
| 493 | 494 |
| 494 void RenderWidgetHostViewAura::InitAsFullscreen( | 495 void RenderWidgetHostViewAura::InitAsFullscreen( |
| 495 RenderWidgetHostView* reference_host_view) { | 496 RenderWidgetHostView* reference_host_view) { |
| 496 CreateAuraWindow(); | 497 CreateAuraWindow(); |
| 497 is_fullscreen_ = true; | 498 is_fullscreen_ = true; |
| 498 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 499 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 499 window_->Init(ui::LAYER_SOLID_COLOR); | 500 window_->Init(ui::LAYER_SOLID_COLOR); |
| 500 window_->SetName("RenderWidgetHostViewAura"); | 501 window_->SetName("RenderWidgetHostViewAura"); |
| 501 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 502 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 502 window_->layer()->SetColor(background_color_); | 503 window_->layer()->SetColor(background_color_); |
| 503 | 504 |
| 504 aura::Window* parent = NULL; | 505 aura::Window* parent = NULL; |
| 505 gfx::Rect bounds; | 506 gfx::Rect bounds; |
| 506 if (reference_host_view) { | 507 if (reference_host_view) { |
| 507 aura::Window* reference_window = | 508 aura::Window* reference_window = |
| 508 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 509 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
| 509 if (reference_window) { | 510 if (reference_window) { |
| 510 host_tracker_.reset(new aura::WindowTracker); | 511 host_tracker_.reset(new aura::WindowTracker); |
| 511 host_tracker_->Add(reference_window); | 512 host_tracker_->Add(reference_window); |
| 512 } | 513 } |
| 513 gfx::Display display = | 514 display::Display display = |
| 514 gfx::Screen::GetScreen()->GetDisplayNearestWindow(reference_window); | 515 display::Screen::GetScreen()->GetDisplayNearestWindow(reference_window); |
| 515 parent = reference_window->GetRootWindow(); | 516 parent = reference_window->GetRootWindow(); |
| 516 bounds = display.bounds(); | 517 bounds = display.bounds(); |
| 517 } | 518 } |
| 518 aura::client::ParentWindowWithContext(window_, parent, bounds); | 519 aura::client::ParentWindowWithContext(window_, parent, bounds); |
| 519 Show(); | 520 Show(); |
| 520 Focus(); | 521 Focus(); |
| 521 | 522 |
| 522 const gfx::Display display = | 523 const display::Display display = |
| 523 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); | 524 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
| 524 device_scale_factor_ = display.device_scale_factor(); | 525 device_scale_factor_ = display.device_scale_factor(); |
| 525 } | 526 } |
| 526 | 527 |
| 527 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 528 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
| 528 return host_; | 529 return host_; |
| 529 } | 530 } |
| 530 | 531 |
| 531 void RenderWidgetHostViewAura::Show() { | 532 void RenderWidgetHostViewAura::Show() { |
| 532 window_->Show(); | 533 window_->Show(); |
| 533 | 534 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 | 858 |
| 858 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { | 859 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { |
| 859 if (insets != insets_) { | 860 if (insets != insets_) { |
| 860 insets_ = insets; | 861 insets_ = insets; |
| 861 host_->WasResized(); | 862 host_->WasResized(); |
| 862 } | 863 } |
| 863 } | 864 } |
| 864 | 865 |
| 865 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 866 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
| 866 current_cursor_ = cursor; | 867 current_cursor_ = cursor; |
| 867 const gfx::Display display = | 868 const display::Display display = |
| 868 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); | 869 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
| 869 current_cursor_.SetDisplayInfo(display); | 870 current_cursor_.SetDisplayInfo(display); |
| 870 UpdateCursorIfOverSelf(); | 871 UpdateCursorIfOverSelf(); |
| 871 } | 872 } |
| 872 | 873 |
| 873 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 874 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
| 874 is_loading_ = is_loading; | 875 is_loading_ = is_loading; |
| 875 UpdateCursorIfOverSelf(); | 876 UpdateCursorIfOverSelf(); |
| 876 } | 877 } |
| 877 | 878 |
| 878 void RenderWidgetHostViewAura::TextInputStateChanged( | 879 void RenderWidgetHostViewAura::TextInputStateChanged( |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 delegated_frame_host_->EndFrameSubscription(); | 1036 delegated_frame_host_->EndFrameSubscription(); |
| 1036 } | 1037 } |
| 1037 | 1038 |
| 1038 #if defined(OS_WIN) | 1039 #if defined(OS_WIN) |
| 1039 bool RenderWidgetHostViewAura::UsesNativeWindowFrame() const { | 1040 bool RenderWidgetHostViewAura::UsesNativeWindowFrame() const { |
| 1040 return (legacy_render_widget_host_HWND_ != NULL); | 1041 return (legacy_render_widget_host_HWND_ != NULL); |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 1044 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
| 1044 RECT window_rect = | 1045 RECT window_rect = |
| 1045 gfx::Screen::GetScreen()->DIPToScreenRectInWindow( | 1046 display::Screen::GetScreen() |
| 1046 window_, window_->GetBoundsInScreen()).ToRECT(); | 1047 ->DIPToScreenRectInWindow(window_, window_->GetBoundsInScreen()) |
| 1048 .ToRECT(); |
| 1047 ::ClipCursor(&window_rect); | 1049 ::ClipCursor(&window_rect); |
| 1048 } | 1050 } |
| 1049 | 1051 |
| 1050 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 1052 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
| 1051 legacy_render_widget_host_HWND_ = NULL; | 1053 legacy_render_widget_host_HWND_ = NULL; |
| 1052 legacy_window_destroyed_ = true; | 1054 legacy_window_destroyed_ = true; |
| 1053 } | 1055 } |
| 1054 #endif | 1056 #endif |
| 1055 | 1057 |
| 1056 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 1058 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 // area. Correct for this by subtracting the frame thickness back off. | 1132 // area. Correct for this by subtracting the frame thickness back off. |
| 1131 if (::IsZoomed(hwnd)) { | 1133 if (::IsZoomed(hwnd)) { |
| 1132 bounds.Inset(GetSystemMetrics(SM_CXSIZEFRAME), | 1134 bounds.Inset(GetSystemMetrics(SM_CXSIZEFRAME), |
| 1133 GetSystemMetrics(SM_CYSIZEFRAME)); | 1135 GetSystemMetrics(SM_CYSIZEFRAME)); |
| 1134 | 1136 |
| 1135 bounds.Inset(GetSystemMetrics(SM_CXPADDEDBORDER), | 1137 bounds.Inset(GetSystemMetrics(SM_CXPADDEDBORDER), |
| 1136 GetSystemMetrics(SM_CXPADDEDBORDER)); | 1138 GetSystemMetrics(SM_CXPADDEDBORDER)); |
| 1137 } | 1139 } |
| 1138 } | 1140 } |
| 1139 | 1141 |
| 1140 bounds = gfx::Screen::GetScreen()->ScreenToDIPRectInWindow(top_level, bounds); | 1142 bounds = |
| 1143 display::Screen::GetScreen()->ScreenToDIPRectInWindow(top_level, bounds); |
| 1141 #endif | 1144 #endif |
| 1142 | 1145 |
| 1143 return bounds; | 1146 return bounds; |
| 1144 } | 1147 } |
| 1145 | 1148 |
| 1146 void RenderWidgetHostViewAura::WheelEventAck( | 1149 void RenderWidgetHostViewAura::WheelEventAck( |
| 1147 const blink::WebMouseWheelEvent& event, | 1150 const blink::WebMouseWheelEvent& event, |
| 1148 InputEventAckState ack_result) { | 1151 InputEventAckState ack_result) { |
| 1149 if (overscroll_controller_) { | 1152 if (overscroll_controller_) { |
| 1150 overscroll_controller_->ReceivedEventACK( | 1153 overscroll_controller_->ReceivedEventACK( |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 } | 1686 } |
| 1684 | 1687 |
| 1685 bool RenderWidgetHostViewAura::IsEditCommandEnabled(int command_id) { | 1688 bool RenderWidgetHostViewAura::IsEditCommandEnabled(int command_id) { |
| 1686 return false; | 1689 return false; |
| 1687 } | 1690 } |
| 1688 | 1691 |
| 1689 void RenderWidgetHostViewAura::SetEditCommandForNextKeyEvent(int command_id) { | 1692 void RenderWidgetHostViewAura::SetEditCommandForNextKeyEvent(int command_id) { |
| 1690 } | 1693 } |
| 1691 | 1694 |
| 1692 //////////////////////////////////////////////////////////////////////////////// | 1695 //////////////////////////////////////////////////////////////////////////////// |
| 1693 // RenderWidgetHostViewAura, gfx::DisplayObserver implementation: | 1696 // RenderWidgetHostViewAura, display::DisplayObserver implementation: |
| 1694 | 1697 |
| 1695 void RenderWidgetHostViewAura::OnDisplayAdded( | 1698 void RenderWidgetHostViewAura::OnDisplayAdded( |
| 1696 const gfx::Display& new_display) { | 1699 const display::Display& new_display) {} |
| 1697 } | |
| 1698 | 1700 |
| 1699 void RenderWidgetHostViewAura::OnDisplayRemoved( | 1701 void RenderWidgetHostViewAura::OnDisplayRemoved( |
| 1700 const gfx::Display& old_display) { | 1702 const display::Display& old_display) {} |
| 1701 } | |
| 1702 | 1703 |
| 1703 void RenderWidgetHostViewAura::OnDisplayMetricsChanged( | 1704 void RenderWidgetHostViewAura::OnDisplayMetricsChanged( |
| 1704 const gfx::Display& display, uint32_t metrics) { | 1705 const display::Display& display, |
| 1706 uint32_t metrics) { |
| 1705 // The screen info should be updated regardless of the metric change. | 1707 // The screen info should be updated regardless of the metric change. |
| 1706 gfx::Screen* screen = gfx::Screen::GetScreen(); | 1708 display::Screen* screen = display::Screen::GetScreen(); |
| 1707 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { | 1709 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { |
| 1708 UpdateScreenInfo(window_); | 1710 UpdateScreenInfo(window_); |
| 1709 current_cursor_.SetDisplayInfo(display); | 1711 current_cursor_.SetDisplayInfo(display); |
| 1710 UpdateCursorIfOverSelf(); | 1712 UpdateCursorIfOverSelf(); |
| 1711 } | 1713 } |
| 1712 } | 1714 } |
| 1713 | 1715 |
| 1714 //////////////////////////////////////////////////////////////////////////////// | 1716 //////////////////////////////////////////////////////////////////////////////// |
| 1715 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: | 1717 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: |
| 1716 | 1718 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 | 1769 |
| 1768 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1770 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
| 1769 float device_scale_factor) { | 1771 float device_scale_factor) { |
| 1770 // TODO(wjmaclean): can host_ ever be null? | 1772 // TODO(wjmaclean): can host_ ever be null? |
| 1771 if (!host_ || !window_->GetRootWindow()) | 1773 if (!host_ || !window_->GetRootWindow()) |
| 1772 return; | 1774 return; |
| 1773 | 1775 |
| 1774 UpdateScreenInfo(window_); | 1776 UpdateScreenInfo(window_); |
| 1775 | 1777 |
| 1776 device_scale_factor_ = device_scale_factor; | 1778 device_scale_factor_ = device_scale_factor; |
| 1777 const gfx::Display display = gfx::Screen::GetScreen()-> | 1779 const display::Display display = |
| 1778 GetDisplayNearestWindow(window_); | 1780 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
| 1779 DCHECK_EQ(device_scale_factor, display.device_scale_factor()); | 1781 DCHECK_EQ(device_scale_factor, display.device_scale_factor()); |
| 1780 current_cursor_.SetDisplayInfo(display); | 1782 current_cursor_.SetDisplayInfo(display); |
| 1781 SnapToPhysicalPixelBoundary(); | 1783 SnapToPhysicalPixelBoundary(); |
| 1782 } | 1784 } |
| 1783 | 1785 |
| 1784 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { | 1786 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { |
| 1785 #if defined(OS_WIN) | 1787 #if defined(OS_WIN) |
| 1786 // The LegacyRenderWidgetHostHWND instance is destroyed when its window is | 1788 // The LegacyRenderWidgetHostHWND instance is destroyed when its window is |
| 1787 // destroyed. Normally we control when that happens via the Destroy call | 1789 // destroyed. Normally we control when that happens via the Destroy call |
| 1788 // in the dtor. However there may be cases where the window is destroyed | 1790 // in the dtor. However there may be cases where the window is destroyed |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 overscroll_controller_->Cancel(); | 2299 overscroll_controller_->Cancel(); |
| 2298 | 2300 |
| 2299 BrowserAccessibilityManager* manager = | 2301 BrowserAccessibilityManager* manager = |
| 2300 host_->GetRootBrowserAccessibilityManager(); | 2302 host_->GetRootBrowserAccessibilityManager(); |
| 2301 if (manager) | 2303 if (manager) |
| 2302 manager->OnWindowBlurred(); | 2304 manager->OnWindowBlurred(); |
| 2303 | 2305 |
| 2304 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2306 // If we lose the focus while fullscreen, close the window; Pepper Flash |
| 2305 // won't do it for us (unlike NPAPI Flash). However, we do not close the | 2307 // won't do it for us (unlike NPAPI Flash). However, we do not close the |
| 2306 // window if we lose the focus to a window on another display. | 2308 // window if we lose the focus to a window on another display. |
| 2307 gfx::Screen* screen = gfx::Screen::GetScreen(); | 2309 display::Screen* screen = display::Screen::GetScreen(); |
| 2308 bool focusing_other_display = | 2310 bool focusing_other_display = |
| 2309 gained_focus && screen->GetNumDisplays() > 1 && | 2311 gained_focus && screen->GetNumDisplays() > 1 && |
| 2310 (screen->GetDisplayNearestWindow(window_).id() != | 2312 (screen->GetDisplayNearestWindow(window_).id() != |
| 2311 screen->GetDisplayNearestWindow(gained_focus).id()); | 2313 screen->GetDisplayNearestWindow(gained_focus).id()); |
| 2312 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { | 2314 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { |
| 2313 #if defined(OS_WIN) | 2315 #if defined(OS_WIN) |
| 2314 // On Windows, if we are switching to a non Aura Window on a different | 2316 // On Windows, if we are switching to a non Aura Window on a different |
| 2315 // screen we should not close the fullscreen window. | 2317 // screen we should not close the fullscreen window. |
| 2316 if (!gained_focus) { | 2318 if (!gained_focus) { |
| 2317 POINT point = {0}; | 2319 POINT point = {0}; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 selection_controller_.reset(); | 2357 selection_controller_.reset(); |
| 2356 selection_controller_client_.reset(); | 2358 selection_controller_client_.reset(); |
| 2357 | 2359 |
| 2358 delegated_frame_host_.reset(); | 2360 delegated_frame_host_.reset(); |
| 2359 window_observer_.reset(); | 2361 window_observer_.reset(); |
| 2360 if (window_) { | 2362 if (window_) { |
| 2361 if (window_->GetHost()) | 2363 if (window_->GetHost()) |
| 2362 window_->GetHost()->RemoveObserver(this); | 2364 window_->GetHost()->RemoveObserver(this); |
| 2363 UnlockMouse(); | 2365 UnlockMouse(); |
| 2364 aura::client::SetTooltipText(window_, NULL); | 2366 aura::client::SetTooltipText(window_, NULL); |
| 2365 gfx::Screen::GetScreen()->RemoveObserver(this); | 2367 display::Screen::GetScreen()->RemoveObserver(this); |
| 2366 | 2368 |
| 2367 // This call is usually no-op since |this| object is already removed from | 2369 // This call is usually no-op since |this| object is already removed from |
| 2368 // the Aura root window and we don't have a way to get an input method | 2370 // the Aura root window and we don't have a way to get an input method |
| 2369 // object associated with the window, but just in case. | 2371 // object associated with the window, but just in case. |
| 2370 DetachFromInputMethod(); | 2372 DetachFromInputMethod(); |
| 2371 } | 2373 } |
| 2372 if (popup_parent_host_view_) { | 2374 if (popup_parent_host_view_) { |
| 2373 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2375 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
| 2374 popup_parent_host_view_->popup_child_host_view_ == this); | 2376 popup_parent_host_view_->popup_child_host_view_ == this); |
| 2375 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2377 popup_parent_host_view_->popup_child_host_view_ = NULL; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2391 | 2393 |
| 2392 void RenderWidgetHostViewAura::CreateAuraWindow() { | 2394 void RenderWidgetHostViewAura::CreateAuraWindow() { |
| 2393 DCHECK(!window_); | 2395 DCHECK(!window_); |
| 2394 window_ = new aura::Window(this); | 2396 window_ = new aura::Window(this); |
| 2395 window_observer_.reset(new WindowObserver(this)); | 2397 window_observer_.reset(new WindowObserver(this)); |
| 2396 | 2398 |
| 2397 aura::client::SetTooltipText(window_, &tooltip_); | 2399 aura::client::SetTooltipText(window_, &tooltip_); |
| 2398 aura::client::SetActivationDelegate(window_, this); | 2400 aura::client::SetActivationDelegate(window_, this); |
| 2399 aura::client::SetFocusChangeObserver(window_, this); | 2401 aura::client::SetFocusChangeObserver(window_, this); |
| 2400 window_->set_layer_owner_delegate(delegated_frame_host_.get()); | 2402 window_->set_layer_owner_delegate(delegated_frame_host_.get()); |
| 2401 gfx::Screen::GetScreen()->AddObserver(this); | 2403 display::Screen::GetScreen()->AddObserver(this); |
| 2402 } | 2404 } |
| 2403 | 2405 |
| 2404 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2406 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 2405 if (host_->GetProcess()->FastShutdownStarted()) | 2407 if (host_->GetProcess()->FastShutdownStarted()) |
| 2406 return; | 2408 return; |
| 2407 | 2409 |
| 2408 aura::Window* root_window = window_->GetRootWindow(); | 2410 aura::Window* root_window = window_->GetRootWindow(); |
| 2409 if (!root_window) | 2411 if (!root_window) |
| 2410 return; | 2412 return; |
| 2411 | 2413 |
| 2412 gfx::Screen* screen = gfx::Screen::GetScreen(); | 2414 display::Screen* screen = display::Screen::GetScreen(); |
| 2413 DCHECK(screen); | 2415 DCHECK(screen); |
| 2414 | 2416 |
| 2415 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); | 2417 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); |
| 2416 | 2418 |
| 2417 #if !defined(OS_CHROMEOS) | 2419 #if !defined(OS_CHROMEOS) |
| 2418 // Ignore cursor update messages if the window under the cursor is not us. | 2420 // Ignore cursor update messages if the window under the cursor is not us. |
| 2419 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( | 2421 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( |
| 2420 cursor_screen_point); | 2422 cursor_screen_point); |
| 2421 #if defined(OS_WIN) | 2423 #if defined(OS_WIN) |
| 2422 // On Windows we may fail to retrieve the aura Window at the current cursor | 2424 // On Windows we may fail to retrieve the aura Window at the current cursor |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2953 | 2955 |
| 2954 //////////////////////////////////////////////////////////////////////////////// | 2956 //////////////////////////////////////////////////////////////////////////////// |
| 2955 // RenderWidgetHostViewBase, public: | 2957 // RenderWidgetHostViewBase, public: |
| 2956 | 2958 |
| 2957 // static | 2959 // static |
| 2958 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2960 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2959 GetScreenInfoForWindow(results, NULL); | 2961 GetScreenInfoForWindow(results, NULL); |
| 2960 } | 2962 } |
| 2961 | 2963 |
| 2962 } // namespace content | 2964 } // namespace content |
| OLD | NEW |