| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/immersive_revealed_lock.h" | 8 #include "ash/wm/immersive_revealed_lock.h" |
| 9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_manager
.h" |
| 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 12 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 13 #include "chrome/browser/ui/views/frame/top_container_view.h" | 14 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 14 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 15 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 19 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/window/non_client_view.h" | 21 #include "ui/views/window/non_client_view.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void ImmersiveModeControllerAsh::SetupForTest() { | 133 void ImmersiveModeControllerAsh::SetupForTest() { |
| 133 controller_->SetupForTest(); | 134 controller_->SetupForTest(); |
| 134 } | 135 } |
| 135 | 136 |
| 136 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) { | 137 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) { |
| 137 if (observers_enabled_ == enable) | 138 if (observers_enabled_ == enable) |
| 138 return; | 139 return; |
| 139 observers_enabled_ = enable; | 140 observers_enabled_ = enable; |
| 140 | 141 |
| 141 content::Source<FullscreenController> source( | 142 content::Source<FullscreenController> source( |
| 142 browser_view_->browser()->fullscreen_controller()); | 143 browser_view_->browser() |
| 144 ->GetExclusiveAccessControllerManager() |
| 145 ->GetFullscreenController()); |
| 143 if (enable) { | 146 if (enable) { |
| 144 ash::wm::GetWindowState(native_window_)->AddObserver(this); | 147 ash::wm::GetWindowState(native_window_)->AddObserver(this); |
| 145 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); | 148 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); |
| 146 } else { | 149 } else { |
| 147 ash::wm::GetWindowState(native_window_)->RemoveObserver(this); | 150 ash::wm::GetWindowState(native_window_)->RemoveObserver(this); |
| 148 registrar_.Remove(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); | 151 registrar_.Remove(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); |
| 149 } | 152 } |
| 150 } | 153 } |
| 151 | 154 |
| 152 void ImmersiveModeControllerAsh::LayoutBrowserRootView() { | 155 void ImmersiveModeControllerAsh::LayoutBrowserRootView() { |
| 153 views::Widget* widget = browser_view_->frame(); | 156 views::Widget* widget = browser_view_->frame(); |
| 154 // Update the window caption buttons. | 157 // Update the window caption buttons. |
| 155 widget->non_client_view()->frame_view()->ResetWindowControls(); | 158 widget->non_client_view()->frame_view()->ResetWindowControls(); |
| 156 widget->non_client_view()->frame_view()->InvalidateLayout(); | 159 widget->non_client_view()->frame_view()->InvalidateLayout(); |
| 157 browser_view_->InvalidateLayout(); | 160 browser_view_->InvalidateLayout(); |
| 158 widget->GetRootView()->Layout(); | 161 widget->GetRootView()->Layout(); |
| 159 } | 162 } |
| 160 | 163 |
| 161 bool ImmersiveModeControllerAsh::UpdateTabIndicators() { | 164 bool ImmersiveModeControllerAsh::UpdateTabIndicators() { |
| 162 bool has_tabstrip = browser_view_->IsBrowserTypeNormal(); | 165 bool has_tabstrip = browser_view_->IsBrowserTypeNormal(); |
| 163 if (!IsEnabled() || !has_tabstrip) { | 166 if (!IsEnabled() || !has_tabstrip) { |
| 164 use_tab_indicators_ = false; | 167 use_tab_indicators_ = false; |
| 165 } else { | 168 } else { |
| 166 bool in_tab_fullscreen = browser_view_->browser()->fullscreen_controller()-> | 169 bool in_tab_fullscreen = browser_view_->browser() |
| 167 IsWindowFullscreenForTabOrPending(); | 170 ->GetExclusiveAccessControllerManager() |
| 171 ->GetFullscreenController() |
| 172 ->IsWindowFullscreenForTabOrPending(); |
| 168 use_tab_indicators_ = !in_tab_fullscreen; | 173 use_tab_indicators_ = !in_tab_fullscreen; |
| 169 } | 174 } |
| 170 | 175 |
| 171 bool show_tab_indicators = use_tab_indicators_ && !IsRevealed(); | 176 bool show_tab_indicators = use_tab_indicators_ && !IsRevealed(); |
| 172 if (show_tab_indicators != browser_view_->tabstrip()->IsImmersiveStyle()) { | 177 if (show_tab_indicators != browser_view_->tabstrip()->IsImmersiveStyle()) { |
| 173 browser_view_->tabstrip()->SetImmersiveStyle(show_tab_indicators); | 178 browser_view_->tabstrip()->SetImmersiveStyle(show_tab_indicators); |
| 174 return true; | 179 return true; |
| 175 } | 180 } |
| 176 return false; | 181 return false; |
| 177 } | 182 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // prevent it from being revealed. | 258 // prevent it from being revealed. |
| 254 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> | 259 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> |
| 255 IsWindowFullscreenForTabOrPending(); | 260 IsWindowFullscreenForTabOrPending(); |
| 256 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( | 261 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( |
| 257 in_tab_fullscreen); | 262 in_tab_fullscreen); |
| 258 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 263 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
| 259 | 264 |
| 260 if (tab_indicator_visibility_changed) | 265 if (tab_indicator_visibility_changed) |
| 261 LayoutBrowserRootView(); | 266 LayoutBrowserRootView(); |
| 262 } | 267 } |
| OLD | NEW |