OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" | 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 15 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
16 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" | 16 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" |
17 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 17 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
18 #include "chrome/browser/ui/views/frame/top_container_view.h" | 18 #include "chrome/browser/ui/views/frame/top_container_view.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_contents_view.h" | 21 #include "content/public/browser/web_contents_view.h" |
22 #include "ui/aura/client/activation_client.h" | 22 #include "ui/aura/client/activation_client.h" |
23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
24 #include "ui/aura/client/capture_client.h" | 24 #include "ui/aura/client/capture_client.h" |
25 #include "ui/aura/client/cursor_client.h" | 25 #include "ui/aura/client/cursor_client.h" |
26 #include "ui/aura/client/screen_position_client.h" | 26 #include "ui/aura/client/screen_position_client.h" |
27 #include "ui/aura/env.h" | 27 #include "ui/aura/env.h" |
28 #include "ui/aura/root_window.h" | 28 #include "ui/aura/root_window.h" |
29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
30 #include "ui/base/animation/slide_animation.h" | 30 #include "ui/gfx/animation/slide_animation.h" |
31 #include "ui/views/bubble/bubble_delegate.h" | 31 #include "ui/views/bubble/bubble_delegate.h" |
32 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
34 #include "ui/views/window/non_client_view.h" | 34 #include "ui/views/window/non_client_view.h" |
35 | 35 |
36 using views::View; | 36 using views::View; |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 // The slide open/closed animation looks better if it starts and ends just a | 40 // The slide open/closed animation looks better if it starts and ends just a |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 widget_(NULL), | 264 widget_(NULL), |
265 top_container_(NULL), | 265 top_container_(NULL), |
266 observers_enabled_(false), | 266 observers_enabled_(false), |
267 enabled_(false), | 267 enabled_(false), |
268 reveal_state_(CLOSED), | 268 reveal_state_(CLOSED), |
269 revealed_lock_count_(0), | 269 revealed_lock_count_(0), |
270 tab_indicator_visibility_(TAB_INDICATORS_HIDE), | 270 tab_indicator_visibility_(TAB_INDICATORS_HIDE), |
271 mouse_x_when_hit_top_in_screen_(-1), | 271 mouse_x_when_hit_top_in_screen_(-1), |
272 gesture_begun_(false), | 272 gesture_begun_(false), |
273 native_window_(NULL), | 273 native_window_(NULL), |
274 animation_(new ui::SlideAnimation(this)), | 274 animation_(new gfx::SlideAnimation(this)), |
275 animations_disabled_for_test_(false), | 275 animations_disabled_for_test_(false), |
276 weak_ptr_factory_(this) { | 276 weak_ptr_factory_(this) { |
277 } | 277 } |
278 | 278 |
279 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { | 279 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { |
280 // The browser view is being destroyed so there's no need to update its | 280 // The browser view is being destroyed so there's no need to update its |
281 // layout or layers, even if the top views are revealed. But the window | 281 // layout or layers, even if the top views are revealed. But the window |
282 // observers still need to be removed. | 282 // observers still need to be removed. |
283 EnableWindowObservers(false); | 283 EnableWindowObservers(false); |
284 } | 284 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 // stay revealed. We cannot call UpdateLocatedEventRevealedLock() from | 522 // stay revealed. We cannot call UpdateLocatedEventRevealedLock() from |
523 // BubbleManager::UpdateRevealedLock() because |widget| is not yet active | 523 // BubbleManager::UpdateRevealedLock() because |widget| is not yet active |
524 // at that time. | 524 // at that time. |
525 UpdateLocatedEventRevealedLock(NULL, ALLOW_REVEAL_WHILE_CLOSING_YES); | 525 UpdateLocatedEventRevealedLock(NULL, ALLOW_REVEAL_WHILE_CLOSING_YES); |
526 } | 526 } |
527 | 527 |
528 //////////////////////////////////////////////////////////////////////////////// | 528 //////////////////////////////////////////////////////////////////////////////// |
529 // Animation delegate: | 529 // Animation delegate: |
530 | 530 |
531 void ImmersiveModeControllerAsh::AnimationEnded( | 531 void ImmersiveModeControllerAsh::AnimationEnded( |
532 const ui::Animation* animation) { | 532 const gfx::Animation* animation) { |
533 if (reveal_state_ == SLIDING_OPEN) { | 533 if (reveal_state_ == SLIDING_OPEN) { |
534 // AnimationProgressed() is called immediately before AnimationEnded() | 534 // AnimationProgressed() is called immediately before AnimationEnded() |
535 // and does a layout. | 535 // and does a layout. |
536 OnSlideOpenAnimationCompleted(LAYOUT_NO); | 536 OnSlideOpenAnimationCompleted(LAYOUT_NO); |
537 } else if (reveal_state_ == SLIDING_CLOSED) { | 537 } else if (reveal_state_ == SLIDING_CLOSED) { |
538 OnSlideClosedAnimationCompleted(); | 538 OnSlideClosedAnimationCompleted(); |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 void ImmersiveModeControllerAsh::AnimationProgressed( | 542 void ImmersiveModeControllerAsh::AnimationProgressed( |
543 const ui::Animation* animation) { | 543 const gfx::Animation* animation) { |
544 // Relayout. This will also move any views whose position depends on the | 544 // Relayout. This will also move any views whose position depends on the |
545 // top container position such as the find bar. | 545 // top container position such as the find bar. |
546 // We do not call LayoutBrowserRootView() here because we are not toggling | 546 // We do not call LayoutBrowserRootView() here because we are not toggling |
547 // the tab strip's immersive style so relaying out the non client view is not | 547 // the tab strip's immersive style so relaying out the non client view is not |
548 // necessary. | 548 // necessary. |
549 top_container_->parent()->Layout(); | 549 top_container_->parent()->Layout(); |
550 } | 550 } |
551 | 551 |
552 //////////////////////////////////////////////////////////////////////////////// | 552 //////////////////////////////////////////////////////////////////////////////// |
553 // aura::WindowObserver overrides: | 553 // aura::WindowObserver overrides: |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 aura::Window* transient_child = transient_children[i]; | 1169 aura::Window* transient_child = transient_children[i]; |
1170 views::BubbleDelegateView* bubble_delegate = | 1170 views::BubbleDelegateView* bubble_delegate = |
1171 AsBubbleDelegate(transient_child); | 1171 AsBubbleDelegate(transient_child); |
1172 if (bubble_delegate && | 1172 if (bubble_delegate && |
1173 bubble_delegate->anchor_view() && | 1173 bubble_delegate->anchor_view() && |
1174 top_container_->Contains(bubble_delegate->anchor_view())) { | 1174 top_container_->Contains(bubble_delegate->anchor_view())) { |
1175 bubble_manager_->StartObserving(transient_child); | 1175 bubble_manager_->StartObserving(transient_child); |
1176 } | 1176 } |
1177 } | 1177 } |
1178 } | 1178 } |
OLD | NEW |