| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/immersive_fullscreen_controller.h" | 5 #include "ash/wm/immersive_fullscreen_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/wm/common/window_state.h" | 11 #include "ash/wm/common/window_state.h" |
| 12 #include "ash/wm/resize_handle_window_targeter.h" | 12 #include "ash/wm/resize_handle_window_targeter.h" |
| 13 #include "ash/wm/window_state_aura.h" | 13 #include "ash/wm/window_state_aura.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/client/capture_client.h" | 16 #include "ui/aura/client/capture_client.h" |
| 17 #include "ui/aura/client/cursor_client.h" | 17 #include "ui/aura/client/cursor_client.h" |
| 18 #include "ui/aura/client/screen_position_client.h" | 18 #include "ui/aura/client/screen_position_client.h" |
| 19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 22 #include "ui/display/display.h" |
| 23 #include "ui/display/screen.h" |
| 22 #include "ui/gfx/animation/slide_animation.h" | 24 #include "ui/gfx/animation/slide_animation.h" |
| 23 #include "ui/gfx/display.h" | |
| 24 #include "ui/gfx/geometry/point.h" | 25 #include "ui/gfx/geometry/point.h" |
| 25 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
| 26 #include "ui/gfx/screen.h" | |
| 27 #include "ui/views/bubble/bubble_dialog_delegate.h" | 27 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 28 #include "ui/views/view.h" | 28 #include "ui/views/view.h" |
| 29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 30 #include "ui/wm/core/transient_window_manager.h" | 30 #include "ui/wm/core/transient_window_manager.h" |
| 31 #include "ui/wm/core/window_util.h" | 31 #include "ui/wm/core/window_util.h" |
| 32 #include "ui/wm/public/activation_client.h" | 32 #include "ui/wm/public/activation_client.h" |
| 33 | 33 |
| 34 using views::View; | 34 using views::View; |
| 35 | 35 |
| 36 namespace ash { | 36 namespace ash { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 gfx::Point location_in_screen = event.location(); | 100 gfx::Point location_in_screen = event.location(); |
| 101 aura::Window* target = static_cast<aura::Window*>(event.target()); | 101 aura::Window* target = static_cast<aura::Window*>(event.target()); |
| 102 aura::client::ScreenPositionClient* screen_position_client = | 102 aura::client::ScreenPositionClient* screen_position_client = |
| 103 aura::client::GetScreenPositionClient(target->GetRootWindow()); | 103 aura::client::GetScreenPositionClient(target->GetRootWindow()); |
| 104 screen_position_client->ConvertPointToScreen(target, &location_in_screen); | 104 screen_position_client->ConvertPointToScreen(target, &location_in_screen); |
| 105 return location_in_screen; | 105 return location_in_screen; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Returns the bounds of the display nearest to |window| in screen coordinates. | 108 // Returns the bounds of the display nearest to |window| in screen coordinates. |
| 109 gfx::Rect GetDisplayBoundsInScreen(aura::Window* window) { | 109 gfx::Rect GetDisplayBoundsInScreen(aura::Window* window) { |
| 110 return gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); | 110 return display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace | 113 } // namespace |
| 114 | 114 |
| 115 // The height in pixels of the region below the top edge of the display in which | 115 // The height in pixels of the region below the top edge of the display in which |
| 116 // the mouse can trigger revealing the top-of-window views. | 116 // the mouse can trigger revealing the top-of-window views. |
| 117 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
| 118 // Windows 8 reserves some pixels at the top of the screen for the hand icon | 118 // Windows 8 reserves some pixels at the top of the screen for the hand icon |
| 119 // that allows you to drag a metro app off the screen, so a few additional | 119 // that allows you to drag a metro app off the screen, so a few additional |
| 120 // pixels of space must be reserved for the mouse reveal. | 120 // pixels of space must be reserved for the mouse reveal. |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 gfx::Rect hit_bounds_in_screen(GetDisplayBoundsInScreen(native_window_)); | 917 gfx::Rect hit_bounds_in_screen(GetDisplayBoundsInScreen(native_window_)); |
| 918 hit_bounds_in_screen.set_height(kImmersiveFullscreenTopEdgeInset); | 918 hit_bounds_in_screen.set_height(kImmersiveFullscreenTopEdgeInset); |
| 919 if (hit_bounds_in_screen.Contains(location)) | 919 if (hit_bounds_in_screen.Contains(location)) |
| 920 return true; | 920 return true; |
| 921 | 921 |
| 922 // There may be a bezel sensor off screen logically above | 922 // There may be a bezel sensor off screen logically above |
| 923 // |hit_bounds_in_screen|. The check for the event not contained by the | 923 // |hit_bounds_in_screen|. The check for the event not contained by the |
| 924 // closest screen ensures that the event is from a valid bezel (as opposed to | 924 // closest screen ensures that the event is from a valid bezel (as opposed to |
| 925 // another screen in an extended desktop). | 925 // another screen in an extended desktop). |
| 926 gfx::Rect screen_bounds = | 926 gfx::Rect screen_bounds = |
| 927 gfx::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds(); | 927 display::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds(); |
| 928 return (!screen_bounds.Contains(location) && | 928 return (!screen_bounds.Contains(location) && |
| 929 location.y() < hit_bounds_in_screen.y() && | 929 location.y() < hit_bounds_in_screen.y() && |
| 930 location.x() >= hit_bounds_in_screen.x() && | 930 location.x() >= hit_bounds_in_screen.x() && |
| 931 location.x() < hit_bounds_in_screen.right()); | 931 location.x() < hit_bounds_in_screen.right()); |
| 932 } | 932 } |
| 933 | 933 |
| 934 void ImmersiveFullscreenController::RecreateBubbleObserver() { | 934 void ImmersiveFullscreenController::RecreateBubbleObserver() { |
| 935 bubble_observer_.reset(new BubbleObserver(this)); | 935 bubble_observer_.reset(new BubbleObserver(this)); |
| 936 const std::vector<aura::Window*> transient_children = | 936 const std::vector<aura::Window*> transient_children = |
| 937 ::wm::GetTransientChildren(native_window_); | 937 ::wm::GetTransientChildren(native_window_); |
| 938 for (size_t i = 0; i < transient_children.size(); ++i) { | 938 for (size_t i = 0; i < transient_children.size(); ++i) { |
| 939 aura::Window* transient_child = transient_children[i]; | 939 aura::Window* transient_child = transient_children[i]; |
| 940 views::View* anchor_view = GetAnchorView(transient_child); | 940 views::View* anchor_view = GetAnchorView(transient_child); |
| 941 if (anchor_view && top_container_->Contains(anchor_view)) | 941 if (anchor_view && top_container_->Contains(anchor_view)) |
| 942 bubble_observer_->StartObserving(transient_child); | 942 bubble_observer_->StartObserving(transient_child); |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 | 945 |
| 946 } // namespace ash | 946 } // namespace ash |
| OLD | NEW |