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

Side by Side Diff: ash/wm/workspace/phantom_window_controller.cc

Issue 1898223002: Removes most aura dependencies from WindowResizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_aura_from_window_state
Patch Set: nit and merge Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ash/wm/workspace/phantom_window_controller.h" 5 #include "ash/wm/workspace/phantom_window_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/coordinate_conversion.h" 11 #include "ash/wm/aura/wm_window_aura.h"
12 #include "ash/wm/common/root_window_finder.h"
12 #include "grit/ash_resources.h" 13 #include "grit/ash_resources.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/compositor/layer.h" 15 #include "ui/compositor/layer.h"
15 #include "ui/compositor/scoped_layer_animation_settings.h" 16 #include "ui/compositor/scoped_layer_animation_settings.h"
16 #include "ui/views/background.h" 17 #include "ui/views/background.h"
17 #include "ui/views/painter.h" 18 #include "ui/views/painter.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 21
21 namespace ash { 22 namespace ash {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 int start_width = std::max( 91 int start_width = std::max(
91 kMinSizeWithShadow, 92 kMinSizeWithShadow,
92 static_cast<int>(start_bounds_in_screen.width() * kStartBoundsRatio)); 93 static_cast<int>(start_bounds_in_screen.width() * kStartBoundsRatio));
93 int start_height = std::max( 94 int start_height = std::max(
94 kMinSizeWithShadow, 95 kMinSizeWithShadow,
95 static_cast<int>(start_bounds_in_screen.height() * kStartBoundsRatio)); 96 static_cast<int>(start_bounds_in_screen.height() * kStartBoundsRatio));
96 start_bounds_in_screen.Inset( 97 start_bounds_in_screen.Inset(
97 floor((start_bounds_in_screen.width() - start_width) / 2.0f), 98 floor((start_bounds_in_screen.width() - start_width) / 2.0f),
98 floor((start_bounds_in_screen.height() - start_height) / 2.0f)); 99 floor((start_bounds_in_screen.height() - start_height) / 2.0f));
99 phantom_widget_ = CreatePhantomWidget( 100 phantom_widget_ = CreatePhantomWidget(
100 wm::GetRootWindowMatching(target_bounds_in_screen_), 101 wm::WmWindowAura::GetAuraWindow(
102 wm::GetRootWindowMatching(target_bounds_in_screen_)),
101 start_bounds_in_screen); 103 start_bounds_in_screen);
102 104
103 AnimateToBounds(phantom_widget_.get(), target_bounds_in_screen_); 105 AnimateToBounds(phantom_widget_.get(), target_bounds_in_screen_);
104 } 106 }
105 107
106 std::unique_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget( 108 std::unique_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget(
107 aura::Window* root_window, 109 aura::Window* root_window,
108 const gfx::Rect& bounds_in_screen) { 110 const gfx::Rect& bounds_in_screen) {
109 std::unique_ptr<views::Widget> phantom_widget(new views::Widget); 111 std::unique_ptr<views::Widget> phantom_widget(new views::Widget);
110 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 112 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
(...skipping 29 matching lines...) Expand all
140 widget_layer->SetOpacity(0); 142 widget_layer->SetOpacity(0);
141 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); 143 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator());
142 scoped_setter.SetTransitionDuration( 144 scoped_setter.SetTransitionDuration(
143 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); 145 base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
144 widget_layer->SetOpacity(1); 146 widget_layer->SetOpacity(1);
145 147
146 return phantom_widget; 148 return phantom_widget;
147 } 149 }
148 150
149 } // namespace ash 151 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/multi_window_resize_controller.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698