Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc

Issue 836933005: Refactor fullscreen_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build break Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 132
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(browser_view_->browser()
142 browser_view_->browser()->fullscreen_controller()); 143 ->GetExclusiveAccessManager()
144 ->GetFullscreenController());
143 if (enable) { 145 if (enable) {
144 ash::wm::GetWindowState(native_window_)->AddObserver(this); 146 ash::wm::GetWindowState(native_window_)->AddObserver(this);
145 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); 147 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source);
146 } else { 148 } else {
147 ash::wm::GetWindowState(native_window_)->RemoveObserver(this); 149 ash::wm::GetWindowState(native_window_)->RemoveObserver(this);
148 registrar_.Remove(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); 150 registrar_.Remove(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source);
149 } 151 }
150 } 152 }
151 153
152 void ImmersiveModeControllerAsh::LayoutBrowserRootView() { 154 void ImmersiveModeControllerAsh::LayoutBrowserRootView() {
153 views::Widget* widget = browser_view_->frame(); 155 views::Widget* widget = browser_view_->frame();
154 // Update the window caption buttons. 156 // Update the window caption buttons.
155 widget->non_client_view()->frame_view()->ResetWindowControls(); 157 widget->non_client_view()->frame_view()->ResetWindowControls();
156 widget->non_client_view()->frame_view()->InvalidateLayout(); 158 widget->non_client_view()->frame_view()->InvalidateLayout();
157 browser_view_->InvalidateLayout(); 159 browser_view_->InvalidateLayout();
158 widget->GetRootView()->Layout(); 160 widget->GetRootView()->Layout();
159 } 161 }
160 162
161 bool ImmersiveModeControllerAsh::UpdateTabIndicators() { 163 bool ImmersiveModeControllerAsh::UpdateTabIndicators() {
162 bool has_tabstrip = browser_view_->IsBrowserTypeNormal(); 164 bool has_tabstrip = browser_view_->IsBrowserTypeNormal();
163 if (!IsEnabled() || !has_tabstrip) { 165 if (!IsEnabled() || !has_tabstrip) {
164 use_tab_indicators_ = false; 166 use_tab_indicators_ = false;
165 } else { 167 } else {
166 bool in_tab_fullscreen = browser_view_->browser()->fullscreen_controller()-> 168 bool in_tab_fullscreen = browser_view_->browser()
167 IsWindowFullscreenForTabOrPending(); 169 ->GetExclusiveAccessManager()
170 ->GetFullscreenController()
171 ->IsWindowFullscreenForTabOrPending();
168 use_tab_indicators_ = !in_tab_fullscreen; 172 use_tab_indicators_ = !in_tab_fullscreen;
169 } 173 }
170 174
171 bool show_tab_indicators = use_tab_indicators_ && !IsRevealed(); 175 bool show_tab_indicators = use_tab_indicators_ && !IsRevealed();
172 if (show_tab_indicators != browser_view_->tabstrip()->IsImmersiveStyle()) { 176 if (show_tab_indicators != browser_view_->tabstrip()->IsImmersiveStyle()) {
173 browser_view_->tabstrip()->SetImmersiveStyle(show_tab_indicators); 177 browser_view_->tabstrip()->SetImmersiveStyle(show_tab_indicators);
174 return true; 178 return true;
175 } 179 }
176 return false; 180 return false;
177 } 181 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // prevent it from being revealed. 257 // prevent it from being revealed.
254 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> 258 bool in_tab_fullscreen = content::Source<FullscreenController>(source)->
255 IsWindowFullscreenForTabOrPending(); 259 IsWindowFullscreenForTabOrPending();
256 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( 260 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen(
257 in_tab_fullscreen); 261 in_tab_fullscreen);
258 ash::Shell::GetInstance()->UpdateShelfVisibility(); 262 ash::Shell::GetInstance()->UpdateShelfVisibility();
259 263
260 if (tab_indicator_visibility_changed) 264 if (tab_indicator_visibility_changed)
261 LayoutBrowserRootView(); 265 LayoutBrowserRootView();
262 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698