| 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 return; | 926 return; |
| 927 } | 927 } |
| 928 // Slide in the reveal view. | 928 // Slide in the reveal view. |
| 929 if (animate == ANIMATE_NO) { | 929 if (animate == ANIMATE_NO) { |
| 930 animation_->Reset(1); | 930 animation_->Reset(1); |
| 931 OnSlideOpenAnimationCompleted(LAYOUT_YES); | 931 OnSlideOpenAnimationCompleted(LAYOUT_YES); |
| 932 } else { | 932 } else { |
| 933 animation_->SetSlideDuration(GetAnimationDuration(animate)); | 933 animation_->SetSlideDuration(GetAnimationDuration(animate)); |
| 934 animation_->Show(); | 934 animation_->Show(); |
| 935 } | 935 } |
| 936 |
| 937 if (previous_reveal_state == CLOSED) { |
| 938 FOR_EACH_OBSERVER(Observer, observers_, OnImmersiveRevealStarted()); |
| 939 } |
| 936 } | 940 } |
| 937 | 941 |
| 938 void ImmersiveModeControllerAsh::EnablePaintToLayer(bool enable) { | 942 void ImmersiveModeControllerAsh::EnablePaintToLayer(bool enable) { |
| 939 top_container_->SetPaintToLayer(enable); | 943 top_container_->SetPaintToLayer(enable); |
| 940 | 944 |
| 941 // Views software compositing is not fully layer aware. If the bookmark bar | 945 // Views software compositing is not fully layer aware. If the bookmark bar |
| 942 // is detached while the top container layer slides on or off the screen, | 946 // is detached while the top container layer slides on or off the screen, |
| 943 // the pixels that become exposed are the remnants of the last software | 947 // the pixels that become exposed are the remnants of the last software |
| 944 // composite of the BrowserView, not the freshly-exposed bookmark bar. | 948 // composite of the BrowserView, not the freshly-exposed bookmark bar. |
| 945 // Force the bookmark bar to paint to a layer so the views composite | 949 // 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... |
| 1059 if (!native_window_) | 1063 if (!native_window_) |
| 1060 return; | 1064 return; |
| 1061 aura::RootWindow* root_window = native_window_->GetRootWindow(); | 1065 aura::RootWindow* root_window = native_window_->GetRootWindow(); |
| 1062 if (!root_window) | 1066 if (!root_window) |
| 1063 return; | 1067 return; |
| 1064 if (observers_enabled_) | 1068 if (observers_enabled_) |
| 1065 root_window->AddPreTargetHandler(this); | 1069 root_window->AddPreTargetHandler(this); |
| 1066 else | 1070 else |
| 1067 root_window->RemovePreTargetHandler(this); | 1071 root_window->RemovePreTargetHandler(this); |
| 1068 } | 1072 } |
| OLD | NEW |