OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/shelf/shelf.h" | |
8 #include "ash/shelf/shelf_constants.h" | |
9 #include "ash/shelf/shelf_layout_manager.h" | |
10 #include "ash/shelf/shelf_layout_manager_observer.h" | |
11 #include "ash/shelf/shelf_types.h" | |
12 #include "ash/shelf/shelf_widget.h" | |
13 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
| 8 #include "ash/wm/common/shelf/wm_shelf.h" |
| 9 #include "ash/wm/common/shelf/wm_shelf_constants.h" |
| 10 #include "ash/wm/common/shelf/wm_shelf_observer.h" |
14 #include "ash/wm/common/window_animation_types.h" | 11 #include "ash/wm/common/window_animation_types.h" |
15 #include "ash/wm/common/window_parenting_utils.h" | 12 #include "ash/wm/common/window_parenting_utils.h" |
16 #include "ash/wm/common/wm_globals.h" | 13 #include "ash/wm/common/wm_globals.h" |
17 #include "ash/wm/common/wm_root_window_controller.h" | 14 #include "ash/wm/common/wm_root_window_controller.h" |
18 #include "ash/wm/common/wm_window.h" | 15 #include "ash/wm/common/wm_window.h" |
19 #include "ash/wm/window_animations.h" | |
20 #include "ash/wm/window_resizer.h" | 16 #include "ash/wm/window_resizer.h" |
21 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
22 #include "base/auto_reset.h" | 18 #include "base/auto_reset.h" |
23 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
24 #include "grit/ash_resources.h" | 20 #include "grit/ash_resources.h" |
25 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
26 #include "third_party/skia/include/core/SkPaint.h" | 22 #include "third_party/skia/include/core/SkPaint.h" |
27 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/compositor/paint_recorder.h" | 24 #include "ui/compositor/paint_recorder.h" |
29 #include "ui/compositor/scoped_layer_animation_settings.h" | 25 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 13 matching lines...) Expand all Loading... |
43 const int DockedWindowLayoutManager::kMinDockGap = 2; | 39 const int DockedWindowLayoutManager::kMinDockGap = 2; |
44 // static | 40 // static |
45 const int DockedWindowLayoutManager::kIdealWidth = 250; | 41 const int DockedWindowLayoutManager::kIdealWidth = 250; |
46 const int kMinimumHeight = 250; | 42 const int kMinimumHeight = 250; |
47 const int kSlideDurationMs = 120; | 43 const int kSlideDurationMs = 120; |
48 const int kFadeDurationMs = 60; | 44 const int kFadeDurationMs = 60; |
49 const int kMinimizeDurationMs = 720; | 45 const int kMinimizeDurationMs = 720; |
50 | 46 |
51 class DockedBackgroundWidget : public views::Widget, | 47 class DockedBackgroundWidget : public views::Widget, |
52 public BackgroundAnimatorDelegate, | 48 public BackgroundAnimatorDelegate, |
53 public ShelfLayoutManagerObserver { | 49 public wm::WmShelfObserver { |
54 public: | 50 public: |
55 explicit DockedBackgroundWidget(DockedWindowLayoutManager* manager) | 51 explicit DockedBackgroundWidget(DockedWindowLayoutManager* manager) |
56 : manager_(manager), | 52 : manager_(manager), |
57 alignment_(DOCKED_ALIGNMENT_NONE), | 53 alignment_(DOCKED_ALIGNMENT_NONE), |
58 background_animator_(this, 0, kShelfBackgroundAlpha), | 54 background_animator_(this, 0, wm::kShelfBackgroundAlpha), |
59 alpha_(0), | 55 alpha_(0), |
60 opaque_background_(ui::LAYER_SOLID_COLOR), | 56 opaque_background_(ui::LAYER_SOLID_COLOR), |
61 visible_background_type_( | 57 visible_background_type_(manager_->shelf()->GetBackgroundType()), |
62 manager_->shelf()->shelf_widget()->GetBackgroundType()), | |
63 visible_background_change_type_(BACKGROUND_CHANGE_IMMEDIATE) { | 58 visible_background_change_type_(BACKGROUND_CHANGE_IMMEDIATE) { |
64 manager_->shelf()->shelf_layout_manager()->AddObserver(this); | 59 manager_->shelf()->AddObserver(this); |
65 InitWidget(manager_->dock_container()); | 60 InitWidget(manager_->dock_container()); |
66 } | 61 } |
67 | 62 |
68 ~DockedBackgroundWidget() override { | 63 ~DockedBackgroundWidget() override { |
69 manager_->shelf()->shelf_layout_manager()->RemoveObserver(this); | 64 manager_->shelf()->RemoveObserver(this); |
70 } | 65 } |
71 | 66 |
72 // Sets widget bounds and sizes opaque background layer to fill the widget. | 67 // Sets widget bounds and sizes opaque background layer to fill the widget. |
73 void SetBackgroundBounds(const gfx::Rect& bounds, DockedAlignment alignment) { | 68 void SetBackgroundBounds(const gfx::Rect& bounds, DockedAlignment alignment) { |
74 SetBounds(bounds); | 69 SetBounds(bounds); |
75 opaque_background_.SetBounds(gfx::Rect(bounds.size())); | 70 opaque_background_.SetBounds(gfx::Rect(bounds.size())); |
76 alignment_ = alignment; | 71 alignment_ = alignment; |
77 } | 72 } |
78 | 73 |
79 private: | 74 private: |
(...skipping 28 matching lines...) Expand all Loading... |
108 local_window_bounds.height(), false, paint); | 103 local_window_bounds.height(), false, paint); |
109 } | 104 } |
110 | 105 |
111 // BackgroundAnimatorDelegate: | 106 // BackgroundAnimatorDelegate: |
112 void UpdateBackground(int alpha) override { | 107 void UpdateBackground(int alpha) override { |
113 alpha_ = alpha; | 108 alpha_ = alpha; |
114 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); | 109 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); |
115 } | 110 } |
116 | 111 |
117 // ShelfLayoutManagerObserver: | 112 // ShelfLayoutManagerObserver: |
118 void OnBackgroundUpdated(ShelfBackgroundType background_type, | 113 void OnBackgroundUpdated(wm::ShelfBackgroundType background_type, |
119 BackgroundAnimatorChangeType change_type) override { | 114 BackgroundAnimatorChangeType change_type) override { |
120 // Sets the background type. Starts an animation to transition to | 115 // Sets the background type. Starts an animation to transition to |
121 // |background_type| if the widget is visible. If the widget is not visible, | 116 // |background_type| if the widget is visible. If the widget is not visible, |
122 // the animation is postponed till the widget becomes visible. | 117 // the animation is postponed till the widget becomes visible. |
123 visible_background_type_ = background_type; | 118 visible_background_type_ = background_type; |
124 visible_background_change_type_ = change_type; | 119 visible_background_change_type_ = change_type; |
125 if (IsVisible()) | 120 if (IsVisible()) |
126 UpdateBackground(); | 121 UpdateBackground(); |
127 } | 122 } |
128 | 123 |
(...skipping 27 matching lines...) Expand all Loading... |
156 // This background should be explicitly stacked below any windows already in | 151 // This background should be explicitly stacked below any windows already in |
157 // the dock, otherwise the z-order is set by the order in which windows were | 152 // the dock, otherwise the z-order is set by the order in which windows were |
158 // added to the container, and UpdateStacking only manages user windows, not | 153 // added to the container, and UpdateStacking only manages user windows, not |
159 // the background widget. | 154 // the background widget. |
160 parent->StackChildAtBottom(wm_window); | 155 parent->StackChildAtBottom(wm_window); |
161 } | 156 } |
162 | 157 |
163 // Transitions to |visible_background_type_| if the widget is visible and to | 158 // Transitions to |visible_background_type_| if the widget is visible and to |
164 // SHELF_BACKGROUND_DEFAULT if it is not. | 159 // SHELF_BACKGROUND_DEFAULT if it is not. |
165 void UpdateBackground() { | 160 void UpdateBackground() { |
166 ShelfBackgroundType background_type = IsVisible() ? | 161 wm::ShelfBackgroundType background_type = |
167 visible_background_type_ : SHELF_BACKGROUND_DEFAULT; | 162 IsVisible() ? visible_background_type_ : wm::SHELF_BACKGROUND_DEFAULT; |
168 BackgroundAnimatorChangeType change_type = IsVisible() ? | 163 BackgroundAnimatorChangeType change_type = IsVisible() ? |
169 visible_background_change_type_ : BACKGROUND_CHANGE_IMMEDIATE; | 164 visible_background_change_type_ : BACKGROUND_CHANGE_IMMEDIATE; |
170 | 165 |
171 float target_opacity = | 166 float target_opacity = |
172 (background_type == SHELF_BACKGROUND_MAXIMIZED) ? 1.0f : 0.0f; | 167 (background_type == wm::SHELF_BACKGROUND_MAXIMIZED) ? 1.0f : 0.0f; |
173 std::unique_ptr<ui::ScopedLayerAnimationSettings> | 168 std::unique_ptr<ui::ScopedLayerAnimationSettings> |
174 opaque_background_animation; | 169 opaque_background_animation; |
175 if (change_type != BACKGROUND_CHANGE_IMMEDIATE) { | 170 if (change_type != BACKGROUND_CHANGE_IMMEDIATE) { |
176 opaque_background_animation.reset(new ui::ScopedLayerAnimationSettings( | 171 opaque_background_animation.reset(new ui::ScopedLayerAnimationSettings( |
177 opaque_background_.GetAnimator())); | 172 opaque_background_.GetAnimator())); |
178 opaque_background_animation->SetTransitionDuration( | 173 opaque_background_animation->SetTransitionDuration( |
179 base::TimeDelta::FromMilliseconds(kTimeToSwitchBackgroundMs)); | 174 base::TimeDelta::FromMilliseconds(wm::kTimeToSwitchBackgroundMs)); |
180 } | 175 } |
181 opaque_background_.SetOpacity(target_opacity); | 176 opaque_background_.SetOpacity(target_opacity); |
182 | 177 |
183 // TODO(varkha): use ui::Layer on both opaque_background and normal | 178 // TODO(varkha): use ui::Layer on both opaque_background and normal |
184 // background retire background_animator_ at all. It would be simpler. | 179 // background retire background_animator_ at all. It would be simpler. |
185 // See also ShelfWidget::SetPaintsBackground. | 180 // See also ShelfWidget::SetPaintsBackground. |
186 background_animator_.SetPaintsBackground( | 181 background_animator_.SetPaintsBackground( |
187 background_type != SHELF_BACKGROUND_DEFAULT, | 182 background_type != wm::SHELF_BACKGROUND_DEFAULT, change_type); |
188 change_type); | |
189 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); | 183 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); |
190 } | 184 } |
191 | 185 |
192 DockedWindowLayoutManager* manager_; | 186 DockedWindowLayoutManager* manager_; |
193 | 187 |
194 DockedAlignment alignment_; | 188 DockedAlignment alignment_; |
195 | 189 |
196 // The animator for the background transitions. | 190 // The animator for the background transitions. |
197 BackgroundAnimator background_animator_; | 191 BackgroundAnimator background_animator_; |
198 | 192 |
199 // The alpha to use for drawing image assets covering the docked background. | 193 // The alpha to use for drawing image assets covering the docked background. |
200 int alpha_; | 194 int alpha_; |
201 | 195 |
202 // Solid black background that can be made fully opaque. | 196 // Solid black background that can be made fully opaque. |
203 ui::Layer opaque_background_; | 197 ui::Layer opaque_background_; |
204 | 198 |
205 // Backgrounds created from shelf background by 90 or 270 degree rotation. | 199 // Backgrounds created from shelf background by 90 or 270 degree rotation. |
206 gfx::ImageSkia shelf_background_left_; | 200 gfx::ImageSkia shelf_background_left_; |
207 gfx::ImageSkia shelf_background_right_; | 201 gfx::ImageSkia shelf_background_right_; |
208 | 202 |
209 // The background type to use when the widget is visible. When not visible, | 203 // The background type to use when the widget is visible. When not visible, |
210 // the widget uses SHELF_BACKGROUND_DEFAULT. | 204 // the widget uses SHELF_BACKGROUND_DEFAULT. |
211 ShelfBackgroundType visible_background_type_; | 205 wm::ShelfBackgroundType visible_background_type_; |
212 | 206 |
213 // Whether the widget should animate to |visible_background_type_|. | 207 // Whether the widget should animate to |visible_background_type_|. |
214 BackgroundAnimatorChangeType visible_background_change_type_; | 208 BackgroundAnimatorChangeType visible_background_change_type_; |
215 | 209 |
216 DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); | 210 DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); |
217 }; | 211 }; |
218 | 212 |
219 namespace { | 213 namespace { |
220 | 214 |
221 // Returns true if a window is a popup or a transient child. | 215 // Returns true if a window is a popup or a transient child. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 }; | 356 }; |
363 | 357 |
364 //////////////////////////////////////////////////////////////////////////////// | 358 //////////////////////////////////////////////////////////////////////////////// |
365 // A class that observes shelf for bounds changes. | 359 // A class that observes shelf for bounds changes. |
366 class DockedWindowLayoutManager::ShelfWindowObserver | 360 class DockedWindowLayoutManager::ShelfWindowObserver |
367 : public wm::WmWindowObserver { | 361 : public wm::WmWindowObserver { |
368 public: | 362 public: |
369 explicit ShelfWindowObserver( | 363 explicit ShelfWindowObserver( |
370 DockedWindowLayoutManager* docked_layout_manager) | 364 DockedWindowLayoutManager* docked_layout_manager) |
371 : docked_layout_manager_(docked_layout_manager) { | 365 : docked_layout_manager_(docked_layout_manager) { |
372 DCHECK(docked_layout_manager_->shelf()->shelf_widget()); | 366 DCHECK(docked_layout_manager_->shelf()->GetWindow()); |
373 wm::WmWindow::Get(docked_layout_manager_->shelf()->shelf_widget()) | 367 docked_layout_manager_->shelf()->GetWindow()->AddObserver(this); |
374 ->AddObserver(this); | |
375 } | 368 } |
376 | 369 |
377 ~ShelfWindowObserver() override { | 370 ~ShelfWindowObserver() override { |
378 if (docked_layout_manager_->shelf() && | 371 if (docked_layout_manager_->shelf() && |
379 docked_layout_manager_->shelf()->shelf_widget()) { | 372 docked_layout_manager_->shelf()->GetWindow()) { |
380 wm::WmWindow::Get(docked_layout_manager_->shelf()->shelf_widget()) | 373 docked_layout_manager_->shelf()->GetWindow()->RemoveObserver(this); |
381 ->RemoveObserver(this); | |
382 } | 374 } |
383 } | 375 } |
384 | 376 |
385 // wm::WmWindowObserver: | 377 // wm::WmWindowObserver: |
386 void OnWindowBoundsChanged(wm::WmWindow* window, | 378 void OnWindowBoundsChanged(wm::WmWindow* window, |
387 const gfx::Rect& old_bounds, | 379 const gfx::Rect& old_bounds, |
388 const gfx::Rect& new_bounds) override { | 380 const gfx::Rect& new_bounds) override { |
389 shelf_bounds_in_screen_ = | 381 shelf_bounds_in_screen_ = |
390 window->GetParent()->ConvertRectToScreen(new_bounds); | 382 window->GetParent()->ConvertRectToScreen(new_bounds); |
391 docked_layout_manager_->OnShelfBoundsChanged(); | 383 docked_layout_manager_->OnShelfBoundsChanged(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 // count limit so do it here. | 533 // count limit so do it here. |
542 MaybeMinimizeChildrenExcept(dragged_window_); | 534 MaybeMinimizeChildrenExcept(dragged_window_); |
543 } | 535 } |
544 dragged_window_ = nullptr; | 536 dragged_window_ = nullptr; |
545 dragged_bounds_ = gfx::Rect(); | 537 dragged_bounds_ = gfx::Rect(); |
546 Relayout(); | 538 Relayout(); |
547 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 539 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
548 RecordUmaAction(action, source); | 540 RecordUmaAction(action, source); |
549 } | 541 } |
550 | 542 |
551 void DockedWindowLayoutManager::SetShelf(Shelf* shelf) { | 543 void DockedWindowLayoutManager::SetShelf(wm::WmShelf* shelf) { |
552 DCHECK(!shelf_); | 544 DCHECK(!shelf_); |
553 shelf_ = shelf; | 545 shelf_ = shelf; |
554 shelf_observer_.reset(new ShelfWindowObserver(this)); | 546 shelf_observer_.reset(new ShelfWindowObserver(this)); |
555 } | 547 } |
556 | 548 |
557 DockedAlignment DockedWindowLayoutManager::GetAlignmentOfWindow( | 549 DockedAlignment DockedWindowLayoutManager::GetAlignmentOfWindow( |
558 const wm::WmWindow* window) const { | 550 const wm::WmWindow* window) const { |
559 const gfx::Rect& bounds(window->GetBoundsInScreen()); | 551 const gfx::Rect& bounds(window->GetBoundsInScreen()); |
560 | 552 |
561 // Test overlap with an existing docked area first. | 553 // Test overlap with an existing docked area first. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 alignment != DOCKED_ALIGNMENT_NONE && | 621 alignment != DOCKED_ALIGNMENT_NONE && |
630 alignment != desired_alignment) { | 622 alignment != desired_alignment) { |
631 return false; | 623 return false; |
632 } | 624 } |
633 // Do not allow docking on the same side as shelf. | 625 // Do not allow docking on the same side as shelf. |
634 return IsDockedAlignmentValid(desired_alignment); | 626 return IsDockedAlignmentValid(desired_alignment); |
635 } | 627 } |
636 | 628 |
637 bool DockedWindowLayoutManager::IsDockedAlignmentValid( | 629 bool DockedWindowLayoutManager::IsDockedAlignmentValid( |
638 DockedAlignment alignment) const { | 630 DockedAlignment alignment) const { |
639 ShelfAlignment shelf_alignment = shelf_ ? shelf_->alignment() : | 631 wm::ShelfAlignment shelf_alignment = |
640 SHELF_ALIGNMENT_BOTTOM; | 632 shelf_ ? shelf_->GetAlignment() : wm::SHELF_ALIGNMENT_BOTTOM; |
641 if ((alignment == DOCKED_ALIGNMENT_LEFT && | 633 if ((alignment == DOCKED_ALIGNMENT_LEFT && |
642 shelf_alignment == SHELF_ALIGNMENT_LEFT) || | 634 shelf_alignment == wm::SHELF_ALIGNMENT_LEFT) || |
643 (alignment == DOCKED_ALIGNMENT_RIGHT && | 635 (alignment == DOCKED_ALIGNMENT_RIGHT && |
644 shelf_alignment == SHELF_ALIGNMENT_RIGHT)) { | 636 shelf_alignment == wm::SHELF_ALIGNMENT_RIGHT)) { |
645 return false; | 637 return false; |
646 } | 638 } |
647 return true; | 639 return true; |
648 } | 640 } |
649 | 641 |
650 void DockedWindowLayoutManager::MaybeSetDesiredDockedAlignment( | 642 void DockedWindowLayoutManager::MaybeSetDesiredDockedAlignment( |
651 DockedAlignment alignment) { | 643 DockedAlignment alignment) { |
652 // If the requested alignment is |NONE| or there are no | 644 // If the requested alignment is |NONE| or there are no |
653 // docked windows return early as we can't change whether there is a | 645 // docked windows return early as we can't change whether there is a |
654 // dock or not. If the requested alignment is the same as the current | 646 // dock or not. If the requested alignment is the same as the current |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 std::max(min_size.width(), actual_new_bounds.width())); | 744 std::max(min_size.width(), actual_new_bounds.width())); |
753 actual_new_bounds.set_height( | 745 actual_new_bounds.set_height( |
754 std::max(min_size.height(), actual_new_bounds.height())); | 746 std::max(min_size.height(), actual_new_bounds.height())); |
755 } | 747 } |
756 if (IsWindowDocked(child) && child != dragged_window_) | 748 if (IsWindowDocked(child) && child != dragged_window_) |
757 return; | 749 return; |
758 wm::WmSnapToPixelLayoutManager::SetChildBounds(child, actual_new_bounds); | 750 wm::WmSnapToPixelLayoutManager::SetChildBounds(child, actual_new_bounds); |
759 if (IsPopupOrTransient(child)) | 751 if (IsPopupOrTransient(child)) |
760 return; | 752 return; |
761 // Whenever one of our windows is moved or resized enforce layout. | 753 // Whenever one of our windows is moved or resized enforce layout. |
762 ShelfLayoutManager* shelf_layout = shelf_->shelf_layout_manager(); | 754 if (shelf_) |
763 if (shelf_layout) | 755 shelf_->UpdateVisibilityState(); |
764 shelf_layout->UpdateVisibilityState(); | |
765 } | 756 } |
766 | 757 |
767 //////////////////////////////////////////////////////////////////////////////// | 758 //////////////////////////////////////////////////////////////////////////////// |
768 // DockedWindowLayoutManager, ash::ShellObserver implementation: | 759 // DockedWindowLayoutManager, ash::ShellObserver implementation: |
769 | 760 |
770 void DockedWindowLayoutManager::OnWorkAreaChanged() { | 761 void DockedWindowLayoutManager::OnWorkAreaChanged() { |
771 Relayout(); | 762 Relayout(); |
772 UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED); | 763 UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED); |
773 MaybeMinimizeChildrenExcept(dragged_window_); | 764 MaybeMinimizeChildrenExcept(dragged_window_); |
774 } | 765 } |
(...skipping 23 matching lines...) Expand all Loading... |
798 Relayout(); | 789 Relayout(); |
799 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 790 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
800 } | 791 } |
801 | 792 |
802 void DockedWindowLayoutManager::OnShelfAlignmentChanged() { | 793 void DockedWindowLayoutManager::OnShelfAlignmentChanged() { |
803 if (!shelf_ || alignment_ == DOCKED_ALIGNMENT_NONE) | 794 if (!shelf_ || alignment_ == DOCKED_ALIGNMENT_NONE) |
804 return; | 795 return; |
805 | 796 |
806 // Do not allow shelf and dock on the same side. Switch side that | 797 // Do not allow shelf and dock on the same side. Switch side that |
807 // the dock is attached to and move all dock windows to that new side. | 798 // the dock is attached to and move all dock windows to that new side. |
808 ShelfAlignment shelf_alignment = shelf_->alignment(); | 799 wm::ShelfAlignment shelf_alignment = shelf_->GetAlignment(); |
809 if (alignment_ == DOCKED_ALIGNMENT_LEFT && | 800 if (alignment_ == DOCKED_ALIGNMENT_LEFT && |
810 shelf_alignment == SHELF_ALIGNMENT_LEFT) { | 801 shelf_alignment == wm::SHELF_ALIGNMENT_LEFT) { |
811 alignment_ = DOCKED_ALIGNMENT_RIGHT; | 802 alignment_ = DOCKED_ALIGNMENT_RIGHT; |
812 } else if (alignment_ == DOCKED_ALIGNMENT_RIGHT && | 803 } else if (alignment_ == DOCKED_ALIGNMENT_RIGHT && |
813 shelf_alignment == SHELF_ALIGNMENT_RIGHT) { | 804 shelf_alignment == wm::SHELF_ALIGNMENT_RIGHT) { |
814 alignment_ = DOCKED_ALIGNMENT_LEFT; | 805 alignment_ = DOCKED_ALIGNMENT_LEFT; |
815 } | 806 } |
816 Relayout(); | 807 Relayout(); |
817 UpdateDockBounds(DockedWindowLayoutManagerObserver::SHELF_ALIGNMENT_CHANGED); | 808 UpdateDockBounds(DockedWindowLayoutManagerObserver::SHELF_ALIGNMENT_CHANGED); |
818 } | 809 } |
819 | 810 |
820 ///////////////////////////////////////////////////////////////////////////// | 811 ///////////////////////////////////////////////////////////////////////////// |
821 // DockedWindowLayoutManager, WindowStateObserver implementation: | 812 // DockedWindowLayoutManager, WindowStateObserver implementation: |
822 | 813 |
823 void DockedWindowLayoutManager::OnPreWindowStateTypeChange( | 814 void DockedWindowLayoutManager::OnPreWindowStateTypeChange( |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 | 1325 |
1335 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1326 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1336 const gfx::Rect& keyboard_bounds) { | 1327 const gfx::Rect& keyboard_bounds) { |
1337 // This bounds change will have caused a change to the Shelf which does not | 1328 // This bounds change will have caused a change to the Shelf which does not |
1338 // propagate automatically to this class, so manually recalculate bounds. | 1329 // propagate automatically to this class, so manually recalculate bounds. |
1339 Relayout(); | 1330 Relayout(); |
1340 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1331 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1341 } | 1332 } |
1342 | 1333 |
1343 } // namespace ash | 1334 } // namespace ash |
OLD | NEW |