| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wm/window_properties.h" | 9 #include "ash/wm/window_properties.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() | 281 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() |
| 282 : delegate_(NULL), | 282 : delegate_(NULL), |
| 283 widget_(NULL), | 283 widget_(NULL), |
| 284 top_container_(NULL), | 284 top_container_(NULL), |
| 285 observers_enabled_(false), | 285 observers_enabled_(false), |
| 286 enabled_(false), | 286 enabled_(false), |
| 287 reveal_state_(CLOSED), | 287 reveal_state_(CLOSED), |
| 288 revealed_lock_count_(0), | 288 revealed_lock_count_(0), |
| 289 tab_indicator_visibility_(TAB_INDICATORS_HIDE), | 289 tab_indicator_visibility_(TAB_INDICATORS_HIDE), |
| 290 mouse_x_when_hit_top_(-1), | 290 mouse_x_when_hit_top_(-1), |
| 291 gesture_begun_(false), |
| 291 native_window_(NULL), | 292 native_window_(NULL), |
| 292 animation_(new ui::SlideAnimation(this)), | 293 animation_(new ui::SlideAnimation(this)), |
| 293 animations_disabled_for_test_(false), | 294 animations_disabled_for_test_(false), |
| 294 weak_ptr_factory_(this), | 295 weak_ptr_factory_(this) { |
| 295 gesture_begun_(false) { | |
| 296 } | 296 } |
| 297 | 297 |
| 298 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { | 298 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { |
| 299 // The browser view is being destroyed so there's no need to update its | 299 // The browser view is being destroyed so there's no need to update its |
| 300 // layout or layers, even if the top views are revealed. But the window | 300 // layout or layers, even if the top views are revealed. But the window |
| 301 // observers still need to be removed. | 301 // observers still need to be removed. |
| 302 EnableWindowObservers(false); | 302 EnableWindowObservers(false); |
| 303 } | 303 } |
| 304 | 304 |
| 305 void ImmersiveModeControllerAsh::LockRevealedState( | 305 void ImmersiveModeControllerAsh::LockRevealedState( |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 | 937 |
| 938 // Ensure window caption buttons are updated and the view bounds are | 938 // Ensure window caption buttons are updated and the view bounds are |
| 939 // computed at normal (non-immersive-style) size. The layout call moves the | 939 // computed at normal (non-immersive-style) size. The layout call moves the |
| 940 // top-of-window views to their initial offscreen position for the | 940 // top-of-window views to their initial offscreen position for the |
| 941 // animation. | 941 // animation. |
| 942 delegate_->SetImmersiveStyle(false); | 942 delegate_->SetImmersiveStyle(false); |
| 943 LayoutBrowserRootView(); | 943 LayoutBrowserRootView(); |
| 944 | 944 |
| 945 // Do not do any more processing if LayoutBrowserView() changed | 945 // Do not do any more processing if LayoutBrowserView() changed |
| 946 // |reveal_state_|. | 946 // |reveal_state_|. |
| 947 if (reveal_state_ != SLIDING_OPEN) | 947 if (reveal_state_ != SLIDING_OPEN) { |
| 948 if (reveal_state_ == REVEALED) |
| 949 FOR_EACH_OBSERVER(Observer, observers_, OnImmersiveRevealStarted()); |
| 948 return; | 950 return; |
| 951 } |
| 949 } | 952 } |
| 950 // Slide in the reveal view. | 953 // Slide in the reveal view. |
| 951 if (animate == ANIMATE_NO) { | 954 if (animate == ANIMATE_NO) { |
| 952 animation_->Reset(1); | 955 animation_->Reset(1); |
| 953 OnSlideOpenAnimationCompleted(LAYOUT_YES); | 956 OnSlideOpenAnimationCompleted(LAYOUT_YES); |
| 954 } else { | 957 } else { |
| 955 animation_->SetSlideDuration(GetAnimationDuration(animate)); | 958 animation_->SetSlideDuration(GetAnimationDuration(animate)); |
| 956 animation_->Show(); | 959 animation_->Show(); |
| 957 } | 960 } |
| 961 |
| 962 if (previous_reveal_state == CLOSED) |
| 963 FOR_EACH_OBSERVER(Observer, observers_, OnImmersiveRevealStarted()); |
| 958 } | 964 } |
| 959 | 965 |
| 960 void ImmersiveModeControllerAsh::EnablePaintToLayer(bool enable) { | 966 void ImmersiveModeControllerAsh::EnablePaintToLayer(bool enable) { |
| 961 top_container_->SetPaintToLayer(enable); | 967 top_container_->SetPaintToLayer(enable); |
| 962 | 968 |
| 963 // Views software compositing is not fully layer aware. If the bookmark bar | 969 // Views software compositing is not fully layer aware. If the bookmark bar |
| 964 // is detached while the top container layer slides on or off the screen, | 970 // is detached while the top container layer slides on or off the screen, |
| 965 // the pixels that become exposed are the remnants of the last software | 971 // the pixels that become exposed are the remnants of the last software |
| 966 // composite of the BrowserView, not the freshly-exposed bookmark bar. | 972 // composite of the BrowserView, not the freshly-exposed bookmark bar. |
| 967 // Force the bookmark bar to paint to a layer so the views composite | 973 // Force the bookmark bar to paint to a layer so the views composite |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 if (!native_window_) | 1087 if (!native_window_) |
| 1082 return; | 1088 return; |
| 1083 aura::RootWindow* root_window = native_window_->GetRootWindow(); | 1089 aura::RootWindow* root_window = native_window_->GetRootWindow(); |
| 1084 if (!root_window) | 1090 if (!root_window) |
| 1085 return; | 1091 return; |
| 1086 if (observers_enabled_) | 1092 if (observers_enabled_) |
| 1087 root_window->AddPreTargetHandler(this); | 1093 root_window->AddPreTargetHandler(this); |
| 1088 else | 1094 else |
| 1089 root_window->RemovePreTargetHandler(this); | 1095 root_window->RemovePreTargetHandler(this); |
| 1090 } | 1096 } |
| OLD | NEW |