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

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

Issue 2721153004: Remove ash_util namespace (Closed)
Patch Set: Created 3 years, 9 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/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/shared/immersive_revealed_lock.h" 9 #include "ash/shared/immersive_revealed_lock.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) { 173 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) {
174 if (observers_enabled_ == enable) 174 if (observers_enabled_ == enable)
175 return; 175 return;
176 observers_enabled_ = enable; 176 observers_enabled_ = enable;
177 177
178 content::Source<FullscreenController> source(browser_view_->browser() 178 content::Source<FullscreenController> source(browser_view_->browser()
179 ->exclusive_access_manager() 179 ->exclusive_access_manager()
180 ->fullscreen_controller()); 180 ->fullscreen_controller());
181 if (enable) { 181 if (enable) {
182 if (ash_util::IsRunningInMash()) { 182 if (IsRunningInMash()) {
183 browser_view_->GetWidget()->GetNativeView()->GetRootWindow()->AddObserver( 183 browser_view_->GetWidget()->GetNativeView()->GetRootWindow()->AddObserver(
184 this); 184 this);
185 // TODO: http://crbug.com/640381. 185 // TODO: http://crbug.com/640381.
186 NOTIMPLEMENTED(); 186 NOTIMPLEMENTED();
187 } else { 187 } else {
188 ash::wm::GetWindowState(native_window_)->AddObserver(this); 188 ash::wm::GetWindowState(native_window_)->AddObserver(this);
189 } 189 }
190 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); 190 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source);
191 } else { 191 } else {
192 if (ash_util::IsRunningInMash()) { 192 if (IsRunningInMash()) {
193 browser_view_->GetWidget() 193 browser_view_->GetWidget()
194 ->GetNativeView() 194 ->GetNativeView()
195 ->GetRootWindow() 195 ->GetRootWindow()
196 ->RemoveObserver(this); 196 ->RemoveObserver(this);
197 // TODO: http://crbug.com/640381. 197 // TODO: http://crbug.com/640381.
198 NOTIMPLEMENTED(); 198 NOTIMPLEMENTED();
199 } else { 199 } else {
200 ash::wm::GetWindowState(native_window_)->RemoveObserver(this); 200 ash::wm::GetWindowState(native_window_)->RemoveObserver(this);
201 } 201 }
202 registrar_.Remove(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source); 202 registrar_.Remove(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source);
203 } 203 }
204 } 204 }
205 205
206 void ImmersiveModeControllerAsh::LayoutBrowserRootView() { 206 void ImmersiveModeControllerAsh::LayoutBrowserRootView() {
207 views::Widget* widget = browser_view_->frame(); 207 views::Widget* widget = browser_view_->frame();
208 // Update the window caption buttons. 208 // Update the window caption buttons.
209 widget->non_client_view()->frame_view()->ResetWindowControls(); 209 widget->non_client_view()->frame_view()->ResetWindowControls();
210 widget->non_client_view()->frame_view()->InvalidateLayout(); 210 widget->non_client_view()->frame_view()->InvalidateLayout();
211 browser_view_->InvalidateLayout(); 211 browser_view_->InvalidateLayout();
212 widget->GetRootView()->Layout(); 212 widget->GetRootView()->Layout();
213 } 213 }
214 214
215 void ImmersiveModeControllerAsh::CreateMashRevealWidget() { 215 void ImmersiveModeControllerAsh::CreateMashRevealWidget() {
216 if (!ash_util::IsRunningInMash()) 216 if (!IsRunningInMash())
217 return; 217 return;
218 218
219 DCHECK(!mash_reveal_widget_); 219 DCHECK(!mash_reveal_widget_);
220 mash_reveal_widget_ = base::MakeUnique<views::Widget>(); 220 mash_reveal_widget_ = base::MakeUnique<views::Widget>();
221 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_POPUP); 221 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_POPUP);
222 init_params.mus_properties 222 init_params.mus_properties
223 [ui::mojom::WindowManager::kRenderParentTitleArea_Property] = 223 [ui::mojom::WindowManager::kRenderParentTitleArea_Property] =
224 mojo::ConvertTo<std::vector<uint8_t>>( 224 mojo::ConvertTo<std::vector<uint8_t>>(
225 static_cast<aura::PropertyConverter::PrimitiveType>(true)); 225 static_cast<aura::PropertyConverter::PrimitiveType>(true));
226 init_params.mus_properties 226 init_params.mus_properties
(...skipping 25 matching lines...) Expand all
252 } 252 }
253 253
254 void ImmersiveModeControllerAsh::OnImmersiveRevealStarted() { 254 void ImmersiveModeControllerAsh::OnImmersiveRevealStarted() {
255 DestroyMashRevealWidget(); 255 DestroyMashRevealWidget();
256 256
257 visible_fraction_ = 0; 257 visible_fraction_ = 0;
258 browser_view_->top_container()->SetPaintToLayer(); 258 browser_view_->top_container()->SetPaintToLayer();
259 // In mash the window manager (ash) also renders to the non-client area. In 259 // In mash the window manager (ash) also renders to the non-client area. In
260 // order to see the decorations drawn by ash the layer needs to be marked as 260 // order to see the decorations drawn by ash the layer needs to be marked as
261 // not filling bounds opaquely. 261 // not filling bounds opaquely.
262 if (ash_util::IsRunningInMash()) 262 if (IsRunningInMash())
263 browser_view_->top_container()->layer()->SetFillsBoundsOpaquely(false); 263 browser_view_->top_container()->layer()->SetFillsBoundsOpaquely(false);
264 LayoutBrowserRootView(); 264 LayoutBrowserRootView();
265 CreateMashRevealWidget(); 265 CreateMashRevealWidget();
266 for (Observer& observer : observers_) 266 for (Observer& observer : observers_)
267 observer.OnImmersiveRevealStarted(); 267 observer.OnImmersiveRevealStarted();
268 } 268 }
269 269
270 void ImmersiveModeControllerAsh::OnImmersiveRevealEnded() { 270 void ImmersiveModeControllerAsh::OnImmersiveRevealEnded() {
271 DestroyMashRevealWidget(); 271 DestroyMashRevealWidget();
272 visible_fraction_ = 0; 272 visible_fraction_ = 0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 331
332 void ImmersiveModeControllerAsh::Observe( 332 void ImmersiveModeControllerAsh::Observe(
333 int type, 333 int type,
334 const content::NotificationSource& source, 334 const content::NotificationSource& source,
335 const content::NotificationDetails& details) { 335 const content::NotificationDetails& details) {
336 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); 336 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type);
337 if (!controller_->IsEnabled()) 337 if (!controller_->IsEnabled())
338 return; 338 return;
339 339
340 if (ash_util::IsRunningInMash()) { 340 if (IsRunningInMash()) {
341 // TODO: http://crbug.com/640384. 341 // TODO: http://crbug.com/640384.
342 NOTIMPLEMENTED(); 342 NOTIMPLEMENTED();
343 return; 343 return;
344 } 344 }
345 345
346 // Auto hide the shelf in immersive browser fullscreen. 346 // Auto hide the shelf in immersive browser fullscreen.
347 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> 347 bool in_tab_fullscreen = content::Source<FullscreenController>(source)->
348 IsWindowFullscreenForTabOrPending(); 348 IsWindowFullscreenForTabOrPending();
349 ash::wm::GetWindowState(native_window_) 349 ash::wm::GetWindowState(native_window_)
350 ->set_hide_shelf_when_fullscreen(in_tab_fullscreen); 350 ->set_hide_shelf_when_fullscreen(in_tab_fullscreen);
351 ash::Shell::GetInstance()->UpdateShelfVisibility(); 351 ash::Shell::GetInstance()->UpdateShelfVisibility();
352 } 352 }
353 353
354 void ImmersiveModeControllerAsh::OnWindowPropertyChanged(aura::Window* window, 354 void ImmersiveModeControllerAsh::OnWindowPropertyChanged(aura::Window* window,
355 const void* key, 355 const void* key,
356 intptr_t old) { 356 intptr_t old) {
357 // In mash the window manager may move us out of immersive mode by changing 357 // In mash the window manager may move us out of immersive mode by changing
358 // the show state. When this happens notify the controller. 358 // the show state. When this happens notify the controller.
359 DCHECK(ash_util::IsRunningInMash()); 359 DCHECK(IsRunningInMash());
360 if (key == aura::client::kShowStateKey && 360 if (key == aura::client::kShowStateKey &&
361 !browser_view_->GetWidget()->IsFullscreen()) { 361 !browser_view_->GetWidget()->IsFullscreen()) {
362 SetEnabled(false); 362 SetEnabled(false);
363 } 363 }
364 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698