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

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

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 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/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"
11 #include "ash/wm/window_state_aura.h" 11 #include "ash/wm/window_state_aura.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/ui/ash/ash_util.h" 15 #include "chrome/browser/ui/ash/ash_util.h"
16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
18 #include "chrome/browser/ui/views/frame/browser_view.h" 18 #include "chrome/browser/ui/views/frame/browser_view.h"
19 #include "chrome/browser/ui/views/frame/top_container_view.h" 19 #include "chrome/browser/ui/views/frame/top_container_view.h"
20 #include "chrome/browser/ui/views/tabs/tab_strip.h" 20 #include "chrome/browser/ui/views/tabs/tab_strip.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "services/ui/public/cpp/property_type_converters.h" 23 #include "services/ui/public/cpp/property_type_converters.h"
24 #include "services/ui/public/interfaces/window_manager.mojom.h" 24 #include "services/ui/public/interfaces/window_manager.mojom.h"
25 #include "ui/aura/mus/mus_util.h" 25 #include "ui/aura/mus/mus_util.h"
26 #include "ui/aura/mus/property_converter.h" 26 #include "ui/aura/mus/property_converter.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/compositor/layer_type.h"
28 #include "ui/compositor/paint_context.h" 29 #include "ui/compositor/paint_context.h"
29 #include "ui/compositor/paint_recorder.h" 30 #include "ui/compositor/paint_recorder.h"
30 #include "ui/views/mus/mus_client.h" 31 #include "ui/views/mus/mus_client.h"
31 #include "ui/views/view.h" 32 #include "ui/views/view.h"
32 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
33 #include "ui/views/window/non_client_view.h" 34 #include "ui/views/window/non_client_view.h"
34 35
35 namespace { 36 namespace {
36 37
37 // Revealing the TopContainerView looks better if the animation starts and ends 38 // Revealing the TopContainerView looks better if the animation starts and ends
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 254 }
254 255
255 void ImmersiveModeControllerAsh::DestroyMashRevealWidget() { 256 void ImmersiveModeControllerAsh::DestroyMashRevealWidget() {
256 mash_reveal_widget_.reset(); 257 mash_reveal_widget_.reset();
257 } 258 }
258 259
259 void ImmersiveModeControllerAsh::OnImmersiveRevealStarted() { 260 void ImmersiveModeControllerAsh::OnImmersiveRevealStarted() {
260 DestroyMashRevealWidget(); 261 DestroyMashRevealWidget();
261 262
262 visible_fraction_ = 0; 263 visible_fraction_ = 0;
263 browser_view_->top_container()->SetPaintToLayer(true); 264 browser_view_->top_container()->SetPaintToLayer(ui::LAYER_TEXTURED);
264 browser_view_->top_container()->layer()->SetFillsBoundsOpaquely(false); 265 browser_view_->top_container()->layer()->SetFillsBoundsOpaquely(false);
265 UpdateTabIndicators(); 266 UpdateTabIndicators();
266 LayoutBrowserRootView(); 267 LayoutBrowserRootView();
267 CreateMashRevealWidget(); 268 CreateMashRevealWidget();
268 for (Observer& observer : observers_) 269 for (Observer& observer : observers_)
269 observer.OnImmersiveRevealStarted(); 270 observer.OnImmersiveRevealStarted();
270 } 271 }
271 272
272 void ImmersiveModeControllerAsh::OnImmersiveRevealEnded() { 273 void ImmersiveModeControllerAsh::OnImmersiveRevealEnded() {
273 DestroyMashRevealWidget(); 274 DestroyMashRevealWidget();
274 visible_fraction_ = 0; 275 visible_fraction_ = 0;
275 browser_view_->top_container()->SetPaintToLayer(false); 276 browser_view_->top_container()->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
276 UpdateTabIndicators(); 277 UpdateTabIndicators();
277 LayoutBrowserRootView(); 278 LayoutBrowserRootView();
278 } 279 }
279 280
280 void ImmersiveModeControllerAsh::OnImmersiveFullscreenExited() { 281 void ImmersiveModeControllerAsh::OnImmersiveFullscreenExited() {
281 DestroyMashRevealWidget(); 282 DestroyMashRevealWidget();
282 browser_view_->top_container()->SetPaintToLayer(false); 283 browser_view_->top_container()->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
283 UpdateTabIndicators(); 284 UpdateTabIndicators();
284 LayoutBrowserRootView(); 285 LayoutBrowserRootView();
285 } 286 }
286 287
287 void ImmersiveModeControllerAsh::SetVisibleFraction(double visible_fraction) { 288 void ImmersiveModeControllerAsh::SetVisibleFraction(double visible_fraction) {
288 if (visible_fraction_ != visible_fraction) { 289 if (visible_fraction_ != visible_fraction) {
289 visible_fraction_ = visible_fraction; 290 visible_fraction_ = visible_fraction;
290 browser_view_->Layout(); 291 browser_view_->Layout();
291 292
292 if (mash_reveal_widget_) { 293 if (mash_reveal_widget_) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // the shelf completely and prevent it from being revealed. 352 // the shelf completely and prevent it from being revealed.
352 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> 353 bool in_tab_fullscreen = content::Source<FullscreenController>(source)->
353 IsWindowFullscreenForTabOrPending(); 354 IsWindowFullscreenForTabOrPending();
354 ash::wm::GetWindowState(native_window_) 355 ash::wm::GetWindowState(native_window_)
355 ->set_hide_shelf_when_fullscreen(in_tab_fullscreen); 356 ->set_hide_shelf_when_fullscreen(in_tab_fullscreen);
356 ash::Shell::GetInstance()->UpdateShelfVisibility(); 357 ash::Shell::GetInstance()->UpdateShelfVisibility();
357 358
358 if (tab_indicator_visibility_changed) 359 if (tab_indicator_visibility_changed)
359 LayoutBrowserRootView(); 360 LayoutBrowserRootView();
360 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698