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

Side by Side Diff: ash/aura/wm_window_aura.cc

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/aura/wm_window_aura.h" 5 #include "ash/aura/wm_window_aura.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/aura/aura_layout_manager_adapter.h"
9 #include "ash/aura/wm_root_window_controller_aura.h"
10 #include "ash/aura/wm_shell_aura.h"
8 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
9 #include "ash/common/wm/wm_layout_manager.h" 12 #include "ash/common/wm_layout_manager.h"
10 #include "ash/common/wm/wm_window_observer.h" 13 #include "ash/common/wm_window_observer.h"
11 #include "ash/common/wm/wm_window_property.h" 14 #include "ash/common/wm_window_property.h"
12 #include "ash/screen_util.h" 15 #include "ash/screen_util.h"
13 #include "ash/shelf/shelf_util.h" 16 #include "ash/shelf/shelf_util.h"
14 #include "ash/shell.h" 17 #include "ash/shell.h"
15 #include "ash/wm/aura/aura_layout_manager_adapter.h"
16 #include "ash/wm/aura/wm_globals_aura.h"
17 #include "ash/wm/aura/wm_root_window_controller_aura.h"
18 #include "ash/wm/resize_shadow_controller.h" 18 #include "ash/wm/resize_shadow_controller.h"
19 #include "ash/wm/window_animations.h" 19 #include "ash/wm/window_animations.h"
20 #include "ash/wm/window_properties.h" 20 #include "ash/wm/window_properties.h"
21 #include "ash/wm/window_state_aura.h" 21 #include "ash/wm/window_state_aura.h"
22 #include "ash/wm/window_util.h" 22 #include "ash/wm/window_util.h"
23 #include "base/memory/ptr_util.h" 23 #include "base/memory/ptr_util.h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/client/window_tree_client.h" 25 #include "ui/aura/client/window_tree_client.h"
26 #include "ui/aura/layout_manager.h" 26 #include "ui/aura/layout_manager.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/aura/window_delegate.h" 28 #include "ui/aura/window_delegate.h"
29 #include "ui/aura/window_property.h" 29 #include "ui/aura/window_property.h"
30 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
31 #include "ui/compositor/layer_tree_owner.h" 31 #include "ui/compositor/layer_tree_owner.h"
32 #include "ui/compositor/scoped_layer_animation_settings.h" 32 #include "ui/compositor/scoped_layer_animation_settings.h"
33 #include "ui/display/screen.h" 33 #include "ui/display/screen.h"
34 #include "ui/gfx/geometry/insets.h" 34 #include "ui/gfx/geometry/insets.h"
35 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
36 #include "ui/wm/core/coordinate_conversion.h" 36 #include "ui/wm/core/coordinate_conversion.h"
37 #include "ui/wm/core/easy_resize_window_targeter.h" 37 #include "ui/wm/core/easy_resize_window_targeter.h"
38 #include "ui/wm/core/visibility_controller.h" 38 #include "ui/wm/core/visibility_controller.h"
39 #include "ui/wm/core/window_util.h" 39 #include "ui/wm/core/window_util.h"
40 40
41 DECLARE_WINDOW_PROPERTY_TYPE(ash::wm::WmWindowAura*); 41 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmWindowAura*);
42 42
43 namespace ash { 43 namespace ash {
44 namespace wm {
45 44
46 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::wm::WmWindowAura, kWmWindowKey, nullptr); 45 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmWindowAura, kWmWindowKey, nullptr);
47 46
48 namespace { 47 namespace {
49 48
50 // A tentative class to set the bounds on the window. 49 // A tentative class to set the bounds on the window.
51 // TODO(oshima): Once all logic is cleaned up, move this to the real layout 50 // TODO(oshima): Once all logic is cleaned up, move this to the real layout
52 // manager with proper friendship. 51 // manager with proper friendship.
53 class BoundsSetter : public aura::LayoutManager { 52 class BoundsSetter : public aura::LayoutManager {
54 public: 53 public:
55 BoundsSetter() {} 54 BoundsSetter() {}
56 ~BoundsSetter() override {} 55 ~BoundsSetter() override {}
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 112
114 const WmWindow* WmWindowAura::GetRootWindow() const { 113 const WmWindow* WmWindowAura::GetRootWindow() const {
115 return Get(window_->GetRootWindow()); 114 return Get(window_->GetRootWindow());
116 } 115 }
117 116
118 WmRootWindowController* WmWindowAura::GetRootWindowController() { 117 WmRootWindowController* WmWindowAura::GetRootWindowController() {
119 aura::Window* root = window_->GetRootWindow(); 118 aura::Window* root = window_->GetRootWindow();
120 return root ? WmRootWindowControllerAura::Get(root) : nullptr; 119 return root ? WmRootWindowControllerAura::Get(root) : nullptr;
121 } 120 }
122 121
123 WmGlobals* WmWindowAura::GetGlobals() const { 122 WmShell* WmWindowAura::GetShell() const {
124 return WmGlobals::Get(); 123 return WmShell::Get();
125 } 124 }
126 125
127 void WmWindowAura::SetName(const char* name) { 126 void WmWindowAura::SetName(const char* name) {
128 window_->SetName(name); 127 window_->SetName(name);
129 } 128 }
130 129
131 base::string16 WmWindowAura::GetTitle() const { 130 base::string16 WmWindowAura::GetTitle() const {
132 return window_->title(); 131 return window_->title();
133 } 132 }
134 133
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (key == WmWindowProperty::SHELF_ID) 246 if (key == WmWindowProperty::SHELF_ID)
248 return GetShelfIDForWindow(window_); 247 return GetShelfIDForWindow(window_);
249 248
250 if (key == WmWindowProperty::TOP_VIEW_INSET) 249 if (key == WmWindowProperty::TOP_VIEW_INSET)
251 return window_->GetProperty(aura::client::kTopViewInset); 250 return window_->GetProperty(aura::client::kTopViewInset);
252 251
253 NOTREACHED(); 252 NOTREACHED();
254 return 0; 253 return 0;
255 } 254 }
256 255
257 const WindowState* WmWindowAura::GetWindowState() const { 256 const wm::WindowState* WmWindowAura::GetWindowState() const {
258 return ash::wm::GetWindowState(window_); 257 return ash::wm::GetWindowState(window_);
259 } 258 }
260 259
261 WmWindow* WmWindowAura::GetToplevelWindow() { 260 WmWindow* WmWindowAura::GetToplevelWindow() {
262 return Get(window_->GetToplevelWindow()); 261 return Get(window_->GetToplevelWindow());
263 } 262 }
264 263
265 void WmWindowAura::SetParentUsingContext(WmWindow* context, 264 void WmWindowAura::SetParentUsingContext(WmWindow* context,
266 const gfx::Rect& screen_bounds) { 265 const gfx::Rect& screen_bounds) {
267 aura::client::ParentWindowWithContext(window_, GetAuraWindow(context), 266 aura::client::ParentWindowWithContext(window_, GetAuraWindow(context),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return; 336 return;
338 } 337 }
339 338
340 ui::ScopedLayerAnimationSettings settings(window_->layer()->GetAnimator()); 339 ui::ScopedLayerAnimationSettings settings(window_->layer()->GetAnimator());
341 settings.SetTransitionDuration(delta); 340 settings.SetTransitionDuration(delta);
342 window_->SetBounds(bounds); 341 window_->SetBounds(bounds);
343 } 342 }
344 343
345 void WmWindowAura::SetBoundsDirect(const gfx::Rect& bounds) { 344 void WmWindowAura::SetBoundsDirect(const gfx::Rect& bounds) {
346 BoundsSetter().SetBounds(window_, bounds); 345 BoundsSetter().SetBounds(window_, bounds);
347 SnapWindowToPixelBoundary(window_); 346 wm::SnapWindowToPixelBoundary(window_);
348 } 347 }
349 348
350 void WmWindowAura::SetBoundsDirectAnimated(const gfx::Rect& bounds) { 349 void WmWindowAura::SetBoundsDirectAnimated(const gfx::Rect& bounds) {
351 const int kBoundsChangeSlideDurationMs = 120; 350 const int kBoundsChangeSlideDurationMs = 120;
352 351
353 ui::Layer* layer = window_->layer(); 352 ui::Layer* layer = window_->layer();
354 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); 353 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator());
355 slide_settings.SetPreemptionStrategy( 354 slide_settings.SetPreemptionStrategy(
356 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 355 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
357 slide_settings.SetTransitionDuration( 356 slide_settings.SetTransitionDuration(
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 void WmWindowAura::CloseWidget() { 504 void WmWindowAura::CloseWidget() {
506 DCHECK(views::Widget::GetWidgetForNativeView(window_)); 505 DCHECK(views::Widget::GetWidgetForNativeView(window_));
507 views::Widget::GetWidgetForNativeView(window_)->Close(); 506 views::Widget::GetWidgetForNativeView(window_)->Close();
508 } 507 }
509 508
510 bool WmWindowAura::IsFocused() const { 509 bool WmWindowAura::IsFocused() const {
511 return window_->HasFocus(); 510 return window_->HasFocus();
512 } 511 }
513 512
514 bool WmWindowAura::IsActive() const { 513 bool WmWindowAura::IsActive() const {
515 return IsActiveWindow(window_); 514 return wm::IsActiveWindow(window_);
516 } 515 }
517 516
518 void WmWindowAura::Activate() { 517 void WmWindowAura::Activate() {
519 ActivateWindow(window_); 518 wm::ActivateWindow(window_);
520 } 519 }
521 520
522 void WmWindowAura::Deactivate() { 521 void WmWindowAura::Deactivate() {
523 DeactivateWindow(window_); 522 wm::DeactivateWindow(window_);
524 } 523 }
525 524
526 void WmWindowAura::SetFullscreen() { 525 void WmWindowAura::SetFullscreen() {
527 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 526 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
528 } 527 }
529 528
530 void WmWindowAura::Maximize() { 529 void WmWindowAura::Maximize() {
531 return window_->SetProperty(aura::client::kShowStateKey, 530 return window_->SetProperty(aura::client::kShowStateKey,
532 ui::SHOW_STATE_MAXIMIZED); 531 ui::SHOW_STATE_MAXIMIZED);
533 } 532 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 window_->SetProperty( 569 window_->SetProperty(
571 kUsesScreenCoordinatesKey, 570 kUsesScreenCoordinatesKey,
572 behavior == BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 571 behavior == BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
573 } 572 }
574 573
575 void WmWindowAura::SetSnapsChildrenToPhysicalPixelBoundary() { 574 void WmWindowAura::SetSnapsChildrenToPhysicalPixelBoundary() {
576 wm::SetSnapsChildrenToPhysicalPixelBoundary(window_); 575 wm::SetSnapsChildrenToPhysicalPixelBoundary(window_);
577 } 576 }
578 577
579 void WmWindowAura::SnapToPixelBoundaryIfNecessary() { 578 void WmWindowAura::SnapToPixelBoundaryIfNecessary() {
580 SnapWindowToPixelBoundary(window_); 579 wm::SnapWindowToPixelBoundary(window_);
581 } 580 }
582 581
583 void WmWindowAura::SetChildrenUseExtendedHitRegion() { 582 void WmWindowAura::SetChildrenUseExtendedHitRegion() {
584 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize, 583 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize,
585 -kResizeOutsideBoundsSize, 584 -kResizeOutsideBoundsSize,
586 -kResizeOutsideBoundsSize); 585 -kResizeOutsideBoundsSize);
587 gfx::Insets touch_extend = 586 gfx::Insets touch_extend =
588 mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch); 587 mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch);
589 window_->SetEventTargeter(base::WrapUnique( 588 window_->SetEventTargeter(base::WrapUnique(
590 new ::wm::EasyResizeWindowTargeter(window_, mouse_extend, touch_extend))); 589 new ::wm::EasyResizeWindowTargeter(window_, mouse_extend, touch_extend)));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window, 657 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window,
659 bool visible) { 658 bool visible) {
660 FOR_EACH_OBSERVER(WmWindowObserver, observers_, 659 FOR_EACH_OBSERVER(WmWindowObserver, observers_,
661 OnWindowVisibilityChanging(this, visible)); 660 OnWindowVisibilityChanging(this, visible));
662 } 661 }
663 662
664 void WmWindowAura::OnWindowTitleChanged(aura::Window* window) { 663 void WmWindowAura::OnWindowTitleChanged(aura::Window* window) {
665 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowTitleChanged(this)); 664 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowTitleChanged(this));
666 } 665 }
667 666
668 } // namespace wm
669 } // namespace ash 667 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698