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

Side by Side Diff: ash/common/wm/window_dimmer.cc

Issue 2733303004: Removes WmShell::NewWindow() (Closed)
Patch Set: merge and feedback 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/common/wm/window_dimmer.h" 5 #include "ash/common/wm/window_dimmer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/compositor/layer.h" 13 #include "ui/compositor/layer.h"
14 #include "ui/wm/core/window_animations.h" 14 #include "ui/wm/core/window_animations.h"
15 15
16 namespace ash { 16 namespace ash {
17 namespace { 17 namespace {
18 18
19 const int kDefaultDimAnimationDurationMs = 200; 19 const int kDefaultDimAnimationDurationMs = 200;
20 20
21 const float kDefaultDimOpacity = 0.5f; 21 const float kDefaultDimOpacity = 0.5f;
22 22
23 } // namespace 23 } // namespace
24 24
25 WindowDimmer::WindowDimmer(WmWindow* parent) 25 WindowDimmer::WindowDimmer(WmWindow* parent)
26 : parent_(parent), 26 : parent_(parent),
27 window_(WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, 27 window_(WmWindow::Get(
28 ui::LAYER_SOLID_COLOR)) { 28 new aura::Window(nullptr, ui::wm::WINDOW_TYPE_NORMAL))) {
29 window_->aura_window()->Init(ui::LAYER_SOLID_COLOR);
29 window_->SetVisibilityChangesAnimated(); 30 window_->SetVisibilityChangesAnimated();
30 window_->SetVisibilityAnimationType( 31 window_->SetVisibilityAnimationType(
31 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); 32 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
32 window_->SetVisibilityAnimationDuration( 33 window_->SetVisibilityAnimationDuration(
33 base::TimeDelta::FromMilliseconds(kDefaultDimAnimationDurationMs)); 34 base::TimeDelta::FromMilliseconds(kDefaultDimAnimationDurationMs));
34 window_->aura_window()->AddObserver(this); 35 window_->aura_window()->AddObserver(this);
35 36
36 SetDimOpacity(kDefaultDimOpacity); 37 SetDimOpacity(kDefaultDimOpacity);
37 38
38 parent->AddChild(window_); 39 parent->AddChild(window_);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const HierarchyChangeParams& params) { 80 const HierarchyChangeParams& params) {
80 if (WmWindow::Get(params.receiver) == window_ && 81 if (WmWindow::Get(params.receiver) == window_ &&
81 params.target == params.receiver) { 82 params.target == params.receiver) {
82 // This may happen on a display change or some unexpected condition. Hide 83 // This may happen on a display change or some unexpected condition. Hide
83 // the window to ensure it isn't obscuring the wrong thing. 84 // the window to ensure it isn't obscuring the wrong thing.
84 window_->Hide(); 85 window_->Hide();
85 } 86 }
86 } 87 }
87 88
88 } // namespace ash 89 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/test/ash_test.cc ('k') | ash/common/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698