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

Side by Side Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
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/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_constants.h" 10 #include "ash/shelf/shelf_constants.h"
(...skipping 23 matching lines...) Expand all
34 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
35 #include "ui/compositor/scoped_layer_animation_settings.h" 35 #include "ui/compositor/scoped_layer_animation_settings.h"
36 #include "ui/gfx/canvas.h" 36 #include "ui/gfx/canvas.h"
37 #include "ui/gfx/image/image_skia_operations.h" 37 #include "ui/gfx/image/image_skia_operations.h"
38 #include "ui/gfx/rect.h" 38 #include "ui/gfx/rect.h"
39 #include "ui/views/background.h" 39 #include "ui/views/background.h"
40 #include "ui/wm/core/window_util.h" 40 #include "ui/wm/core/window_util.h"
41 #include "ui/wm/public/activation_client.h" 41 #include "ui/wm/public/activation_client.h"
42 42
43 namespace ash { 43 namespace ash {
44 namespace internal {
45 44
46 // Minimum, maximum width of the dock area and a width of the gap 45 // Minimum, maximum width of the dock area and a width of the gap
47 // static 46 // static
48 const int DockedWindowLayoutManager::kMaxDockWidth = 360; 47 const int DockedWindowLayoutManager::kMaxDockWidth = 360;
49 // static 48 // static
50 const int DockedWindowLayoutManager::kMinDockWidth = 200; 49 const int DockedWindowLayoutManager::kMinDockWidth = 200;
51 // static 50 // static
52 const int DockedWindowLayoutManager::kMinDockGap = 2; 51 const int DockedWindowLayoutManager::kMinDockGap = 2;
53 // static 52 // static
54 const int DockedWindowLayoutManager::kIdealWidth = 250; 53 const int DockedWindowLayoutManager::kIdealWidth = 250;
55 const int kMinimumHeight = 250; 54 const int kMinimumHeight = 250;
56 const int kSlideDurationMs = 120; 55 const int kSlideDurationMs = 120;
57 const int kFadeDurationMs = 60; 56 const int kFadeDurationMs = 60;
58 const int kMinimizeDurationMs = 720; 57 const int kMinimizeDurationMs = 720;
59 58
60 class DockedBackgroundWidget : public views::Widget, 59 class DockedBackgroundWidget : public views::Widget,
61 public internal::BackgroundAnimatorDelegate { 60 public BackgroundAnimatorDelegate {
62 public: 61 public:
63 explicit DockedBackgroundWidget(aura::Window* container) 62 explicit DockedBackgroundWidget(aura::Window* container)
64 : alignment_(DOCKED_ALIGNMENT_NONE), 63 : alignment_(DOCKED_ALIGNMENT_NONE),
65 background_animator_(this, 0, kShelfBackgroundAlpha), 64 background_animator_(this, 0, kShelfBackgroundAlpha),
66 alpha_(0), 65 alpha_(0),
67 opaque_background_(ui::LAYER_SOLID_COLOR), 66 opaque_background_(ui::LAYER_SOLID_COLOR),
68 visible_background_type_(SHELF_BACKGROUND_DEFAULT), 67 visible_background_type_(SHELF_BACKGROUND_DEFAULT),
69 visible_background_change_type_(BACKGROUND_CHANGE_IMMEDIATE) { 68 visible_background_change_type_(BACKGROUND_CHANGE_IMMEDIATE) {
70 InitWidget(container); 69 InitWidget(container);
71 } 70 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 params.type = views::Widget::InitParams::TYPE_POPUP; 139 params.type = views::Widget::InitParams::TYPE_POPUP;
141 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 140 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
142 params.can_activate = false; 141 params.can_activate = false;
143 params.keep_on_top = false; 142 params.keep_on_top = false;
144 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 143 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
145 params.parent = parent; 144 params.parent = parent;
146 params.accept_events = false; 145 params.accept_events = false;
147 set_focus_on_creation(false); 146 set_focus_on_creation(false);
148 Init(params); 147 Init(params);
149 SetVisibilityChangedAnimationsEnabled(false); 148 SetVisibilityChangedAnimationsEnabled(false);
150 GetNativeWindow()->SetProperty(internal::kStayInSameRootWindowKey, true); 149 GetNativeWindow()->SetProperty(kStayInSameRootWindowKey, true);
151 opaque_background_.SetColor(SK_ColorBLACK); 150 opaque_background_.SetColor(SK_ColorBLACK);
152 opaque_background_.SetBounds(gfx::Rect(GetWindowBoundsInScreen().size())); 151 opaque_background_.SetBounds(gfx::Rect(GetWindowBoundsInScreen().size()));
153 opaque_background_.SetOpacity(0.0f); 152 opaque_background_.SetOpacity(0.0f);
154 GetNativeWindow()->layer()->Add(&opaque_background_); 153 GetNativeWindow()->layer()->Add(&opaque_background_);
155 Hide(); 154 Hide();
156 155
157 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 156 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
158 gfx::ImageSkia shelf_background = 157 gfx::ImageSkia shelf_background =
159 *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND); 158 *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND);
160 shelf_background_left_ = gfx::ImageSkiaOperations::CreateRotatedImage( 159 shelf_background_left_ = gfx::ImageSkiaOperations::CreateRotatedImage(
(...skipping 26 matching lines...) Expand all
187 // See also ShelfWidget::SetPaintsBackground. 186 // See also ShelfWidget::SetPaintsBackground.
188 background_animator_.SetPaintsBackground( 187 background_animator_.SetPaintsBackground(
189 background_type != SHELF_BACKGROUND_DEFAULT, 188 background_type != SHELF_BACKGROUND_DEFAULT,
190 change_type); 189 change_type);
191 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); 190 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size()));
192 } 191 }
193 192
194 DockedAlignment alignment_; 193 DockedAlignment alignment_;
195 194
196 // The animator for the background transitions. 195 // The animator for the background transitions.
197 internal::BackgroundAnimator background_animator_; 196 BackgroundAnimator background_animator_;
198 197
199 // The alpha to use for drawing image assets covering the docked background. 198 // The alpha to use for drawing image assets covering the docked background.
200 int alpha_; 199 int alpha_;
201 200
202 // Solid black background that can be made fully opaque. 201 // Solid black background that can be made fully opaque.
203 ui::Layer opaque_background_; 202 ui::Layer opaque_background_;
204 203
205 // Backgrounds created from shelf background by 90 or 270 degree rotation. 204 // Backgrounds created from shelf background by 90 or 270 degree rotation.
206 gfx::ImageSkia shelf_background_left_; 205 gfx::ImageSkia shelf_background_left_;
207 gfx::ImageSkia shelf_background_right_; 206 gfx::ImageSkia shelf_background_right_;
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); 704 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED);
706 } 705 }
707 706
708 void DockedWindowLayoutManager::SetChildBounds( 707 void DockedWindowLayoutManager::SetChildBounds(
709 aura::Window* child, 708 aura::Window* child,
710 const gfx::Rect& requested_bounds) { 709 const gfx::Rect& requested_bounds) {
711 // Whenever one of our windows is moved or resized enforce layout. 710 // Whenever one of our windows is moved or resized enforce layout.
712 SetChildBoundsDirect(child, requested_bounds); 711 SetChildBoundsDirect(child, requested_bounds);
713 if (IsPopupOrTransient(child)) 712 if (IsPopupOrTransient(child))
714 return; 713 return;
715 ShelfLayoutManager* shelf_layout = internal::ShelfLayoutManager::ForShelf( 714 ShelfLayoutManager* shelf_layout =
716 dock_container_); 715 ShelfLayoutManager::ForShelf(dock_container_);
717 if (shelf_layout) 716 if (shelf_layout)
718 shelf_layout->UpdateVisibilityState(); 717 shelf_layout->UpdateVisibilityState();
719 } 718 }
720 719
721 //////////////////////////////////////////////////////////////////////////////// 720 ////////////////////////////////////////////////////////////////////////////////
722 // DockedWindowLayoutManager, ash::ShellObserver implementation: 721 // DockedWindowLayoutManager, ash::ShellObserver implementation:
723 722
724 void DockedWindowLayoutManager::OnDisplayWorkAreaInsetsChanged() { 723 void DockedWindowLayoutManager::OnDisplayWorkAreaInsetsChanged() {
725 Relayout(); 724 Relayout();
726 UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED); 725 UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED);
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 // keyboard::KeyboardControllerObserver implementation: 1308 // keyboard::KeyboardControllerObserver implementation:
1310 1309
1311 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( 1310 void DockedWindowLayoutManager::OnKeyboardBoundsChanging(
1312 const gfx::Rect& keyboard_bounds) { 1311 const gfx::Rect& keyboard_bounds) {
1313 // This bounds change will have caused a change to the Shelf which does not 1312 // This bounds change will have caused a change to the Shelf which does not
1314 // propagate automatically to this class, so manually recalculate bounds. 1313 // propagate automatically to this class, so manually recalculate bounds.
1315 Relayout(); 1314 Relayout();
1316 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); 1315 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING);
1317 } 1316 }
1318 1317
1319 } // namespace internal
1320 } // namespace ash 1318 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.h ('k') | ash/wm/dock/docked_window_layout_manager_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698