| 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/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/wm/immersive_revealed_lock.h" | 8 #include "ash/common/wm/immersive_revealed_lock.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 std::unique_ptr<ash::ImmersiveRevealedLock> lock_; | 54 std::unique_ptr<ash::ImmersiveRevealedLock> lock_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(ImmersiveRevealedLockAsh); | 56 DISALLOW_COPY_AND_ASSIGN(ImmersiveRevealedLockAsh); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() | 61 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() |
| 62 : controller_(new ash::ImmersiveFullscreenController), | 62 : ImmersiveModeController(Type::ASH), |
| 63 controller_(new ash::ImmersiveFullscreenController), |
| 63 browser_view_(nullptr), | 64 browser_view_(nullptr), |
| 64 native_window_(nullptr), | 65 native_window_(nullptr), |
| 65 observers_enabled_(false), | 66 observers_enabled_(false), |
| 66 use_tab_indicators_(false), | 67 use_tab_indicators_(false), |
| 67 visible_fraction_(1) { | 68 visible_fraction_(1) {} |
| 68 } | |
| 69 | 69 |
| 70 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { | 70 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { |
| 71 EnableWindowObservers(false); | 71 EnableWindowObservers(false); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ImmersiveModeControllerAsh::Init(BrowserView* browser_view) { | 74 void ImmersiveModeControllerAsh::Init(BrowserView* browser_view) { |
| 75 browser_view_ = browser_view; | 75 browser_view_ = browser_view; |
| 76 native_window_ = browser_view_->GetNativeWindow(); | 76 native_window_ = browser_view_->GetNativeWindow(); |
| 77 controller_->Init(this, browser_view_->frame(), | 77 controller_->Init(this, browser_view_->frame(), |
| 78 browser_view_->top_container()); | 78 browser_view_->top_container()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 AnimateReveal animate_reveal) { | 126 AnimateReveal animate_reveal) { |
| 127 return new ImmersiveRevealedLockAsh(controller_->GetRevealedLock( | 127 return new ImmersiveRevealedLockAsh(controller_->GetRevealedLock( |
| 128 ToImmersiveFullscreenControllerAnimateReveal(animate_reveal))); | 128 ToImmersiveFullscreenControllerAnimateReveal(animate_reveal))); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( | 131 void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( |
| 132 const gfx::Rect& new_visible_bounds_in_screen) { | 132 const gfx::Rect& new_visible_bounds_in_screen) { |
| 133 find_bar_visible_bounds_in_screen_ = new_visible_bounds_in_screen; | 133 find_bar_visible_bounds_in_screen_ = new_visible_bounds_in_screen; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ImmersiveModeControllerAsh::SetupForTest() { | |
| 137 controller_->SetupForTest(); | |
| 138 } | |
| 139 | |
| 140 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) { | 136 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) { |
| 141 if (observers_enabled_ == enable) | 137 if (observers_enabled_ == enable) |
| 142 return; | 138 return; |
| 143 observers_enabled_ = enable; | 139 observers_enabled_ = enable; |
| 144 | 140 |
| 145 content::Source<FullscreenController> source(browser_view_->browser() | 141 content::Source<FullscreenController> source(browser_view_->browser() |
| 146 ->exclusive_access_manager() | 142 ->exclusive_access_manager() |
| 147 ->fullscreen_controller()); | 143 ->fullscreen_controller()); |
| 148 if (enable) { | 144 if (enable) { |
| 149 ash::wm::GetWindowState(native_window_)->AddObserver(this); | 145 ash::wm::GetWindowState(native_window_)->AddObserver(this); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 IsWindowFullscreenForTabOrPending(); | 264 IsWindowFullscreenForTabOrPending(); |
| 269 ash::wm::GetWindowState(native_window_) | 265 ash::wm::GetWindowState(native_window_) |
| 270 ->set_shelf_mode_in_fullscreen( | 266 ->set_shelf_mode_in_fullscreen( |
| 271 in_tab_fullscreen ? ash::wm::WindowState::SHELF_HIDDEN | 267 in_tab_fullscreen ? ash::wm::WindowState::SHELF_HIDDEN |
| 272 : ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); | 268 : ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); |
| 273 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 269 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
| 274 | 270 |
| 275 if (tab_indicator_visibility_changed) | 271 if (tab_indicator_visibility_changed) |
| 276 LayoutBrowserRootView(); | 272 LayoutBrowserRootView(); |
| 277 } | 273 } |
| OLD | NEW |