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/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
11 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" | 11 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" |
12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
13 #include "ash/common/wm_lookup.h" | 13 #include "ash/common/wm_lookup.h" |
14 #include "ash/common/wm_root_window_controller.h" | 14 #include "ash/common/wm_root_window_controller.h" |
15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
16 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
17 #include "ash/wm/immersive_focus_watcher.h" | 17 #include "ash/wm/immersive_focus_watcher.h" |
18 #include "ash/wm/immersive_gesture_handler.h" | 18 #include "ash/wm/immersive_gesture_handler.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "ui/aura/env.h" | |
21 #include "ui/display/display.h" | 20 #include "ui/display/display.h" |
22 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
23 #include "ui/events/base_event_utils.h" | 22 #include "ui/events/base_event_utils.h" |
24 #include "ui/gfx/animation/slide_animation.h" | 23 #include "ui/gfx/animation/slide_animation.h" |
25 #include "ui/gfx/geometry/point.h" | 24 #include "ui/gfx/geometry/point.h" |
26 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
27 #include "ui/views/bubble/bubble_dialog_delegate.h" | 26 #include "ui/views/bubble/bubble_dialog_delegate.h" |
28 #include "ui/views/view.h" | 27 #include "ui/views/view.h" |
29 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
30 | 29 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return enabled_ && reveal_state_ != CLOSED; | 165 return enabled_ && reveal_state_ != CLOSED; |
167 } | 166 } |
168 | 167 |
169 ImmersiveRevealedLock* ImmersiveFullscreenController::GetRevealedLock( | 168 ImmersiveRevealedLock* ImmersiveFullscreenController::GetRevealedLock( |
170 AnimateReveal animate_reveal) { | 169 AnimateReveal animate_reveal) { |
171 return new ImmersiveRevealedLock(weak_ptr_factory_.GetWeakPtr(), | 170 return new ImmersiveRevealedLock(weak_ptr_factory_.GetWeakPtr(), |
172 animate_reveal); | 171 animate_reveal); |
173 } | 172 } |
174 | 173 |
175 //////////////////////////////////////////////////////////////////////////////// | 174 //////////////////////////////////////////////////////////////////////////////// |
176 // Testing interface: | |
177 | |
178 void ImmersiveFullscreenController::SetupForTest() { | |
179 DCHECK(!enabled_); | |
180 animations_disabled_for_test_ = true; | |
181 | |
182 // Move the mouse off of the top-of-window views so that it does not keep the | |
183 // top-of-window views revealed. | |
184 std::vector<gfx::Rect> bounds_in_screen( | |
185 delegate_->GetVisibleBoundsInScreen()); | |
186 DCHECK(!bounds_in_screen.empty()); | |
187 int bottommost_in_screen = bounds_in_screen[0].bottom(); | |
188 for (size_t i = 1; i < bounds_in_screen.size(); ++i) { | |
189 if (bounds_in_screen[i].bottom() > bottommost_in_screen) | |
190 bottommost_in_screen = bounds_in_screen[i].bottom(); | |
191 } | |
192 gfx::Point cursor_pos(0, bottommost_in_screen + 100); | |
193 aura::Env::GetInstance()->set_last_mouse_location(cursor_pos); | |
194 UpdateLocatedEventRevealedLock(); | |
195 } | |
196 | 175 |
197 void ImmersiveFullscreenController::OnMouseEvent( | 176 void ImmersiveFullscreenController::OnMouseEvent( |
198 const ui::MouseEvent& event, | 177 const ui::MouseEvent& event, |
199 const gfx::Point& location_in_screen, | 178 const gfx::Point& location_in_screen, |
200 views::Widget* target) { | 179 views::Widget* target) { |
201 if (!enabled_) | 180 if (!enabled_) |
202 return; | 181 return; |
203 | 182 |
204 if (event.type() != ui::ET_MOUSE_MOVED && | 183 if (event.type() != ui::ET_MOUSE_MOVED && |
205 event.type() != ui::ET_MOUSE_PRESSED && | 184 event.type() != ui::ET_MOUSE_PRESSED && |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 // another screen in an extended desktop). | 658 // another screen in an extended desktop). |
680 gfx::Rect screen_bounds = | 659 gfx::Rect screen_bounds = |
681 display::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds(); | 660 display::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds(); |
682 return (!screen_bounds.Contains(location) && | 661 return (!screen_bounds.Contains(location) && |
683 location.y() < hit_bounds_in_screen.y() && | 662 location.y() < hit_bounds_in_screen.y() && |
684 location.x() >= hit_bounds_in_screen.x() && | 663 location.x() >= hit_bounds_in_screen.x() && |
685 location.x() < hit_bounds_in_screen.right()); | 664 location.x() < hit_bounds_in_screen.right()); |
686 } | 665 } |
687 | 666 |
688 } // namespace ash | 667 } // namespace ash |
OLD | NEW |