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

Side by Side Diff: ash/wm/shelf_layout_manager.h

Issue 11434099: Use the correct launcher assets for shelf alignment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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
« no previous file with comments | « ash/wm/app_list_controller.cc ('k') | ash/wm/shelf_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef ASH_WM_SHELF_LAYOUT_MANAGER_H_ 5 #ifndef ASH_WM_SHELF_LAYOUT_MANAGER_H_
6 #define ASH_WM_SHELF_LAYOUT_MANAGER_H_ 6 #define ASH_WM_SHELF_LAYOUT_MANAGER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/launcher/launcher.h" 9 #include "ash/launcher/launcher.h"
10 #include "ash/shelf_types.h" 10 #include "ash/shelf_types.h"
11 #include "ash/shell_observer.h" 11 #include "ash/shell_observer.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/logging.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "base/timer.h" 16 #include "base/timer.h"
16 #include "ui/aura/layout_manager.h" 17 #include "ui/aura/layout_manager.h"
17 #include "ui/gfx/insets.h" 18 #include "ui/gfx/insets.h"
18 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
19 #include "ui/views/corewm/activation_change_shim.h" 20 #include "ui/views/corewm/activation_change_shim.h"
20 21
21 namespace aura { 22 namespace aura {
22 class RootWindow; 23 class RootWindow;
23 } 24 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 70
70 // Sets the ShelfAutoHideBehavior. See enum description for details. 71 // Sets the ShelfAutoHideBehavior. See enum description for details.
71 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior); 72 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior);
72 ShelfAutoHideBehavior auto_hide_behavior() const { 73 ShelfAutoHideBehavior auto_hide_behavior() const {
73 return auto_hide_behavior_; 74 return auto_hide_behavior_;
74 } 75 }
75 76
76 // Sets the alignment. Returns true if the alignment is changed. Otherwise, 77 // Sets the alignment. Returns true if the alignment is changed. Otherwise,
77 // returns false. 78 // returns false.
78 bool SetAlignment(ShelfAlignment alignment); 79 bool SetAlignment(ShelfAlignment alignment);
79 ShelfAlignment alignment() const { return alignment_; } 80 ShelfAlignment GetAlignment() const { return alignment_; }
80 81
81 void set_workspace_controller(WorkspaceController* controller) { 82 void set_workspace_controller(WorkspaceController* controller) {
82 workspace_controller_ = controller; 83 workspace_controller_ = controller;
83 } 84 }
84 85
85 views::Widget* launcher_widget() { 86 views::Widget* launcher_widget() {
86 return launcher_ ? launcher_->widget() : NULL; 87 return launcher_ ? launcher_->widget() : NULL;
87 } 88 }
88 const views::Widget* launcher_widget() const { 89 const views::Widget* launcher_widget() const {
89 return launcher_ ? launcher_->widget() : NULL; 90 return launcher_ ? launcher_->widget() : NULL;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 virtual void SetChildBounds(aura::Window* child, 150 virtual void SetChildBounds(aura::Window* child,
150 const gfx::Rect& requested_bounds) OVERRIDE; 151 const gfx::Rect& requested_bounds) OVERRIDE;
151 152
152 // Overridden from ash::ShellObserver: 153 // Overridden from ash::ShellObserver:
153 virtual void OnLockStateChanged(bool locked) OVERRIDE; 154 virtual void OnLockStateChanged(bool locked) OVERRIDE;
154 155
155 // Overriden from aura::client::ActivationChangeObserver: 156 // Overriden from aura::client::ActivationChangeObserver:
156 virtual void OnWindowActivated(aura::Window* active, 157 virtual void OnWindowActivated(aura::Window* active,
157 aura::Window* old_active) OVERRIDE; 158 aura::Window* old_active) OVERRIDE;
158 159
160 // TODO(harrym|oshima): These templates will be moved to
161 // new Shelf class.
162 // A helper function that provides a shortcut for choosing
163 // values specific to a shelf alignment.
164 template<typename T>
165 T SelectValueForShelfAlignment(T bottom, T left, T right) const {
166 switch (alignment_) {
167 case SHELF_ALIGNMENT_BOTTOM:
168 return bottom;
169 case SHELF_ALIGNMENT_LEFT:
170 return left;
171 case SHELF_ALIGNMENT_RIGHT:
172 return right;
173 }
174 NOTREACHED();
175 return right;
176 }
177
178 template<typename T>
179 T PrimaryAxisValue(T horizontal, T vertical) const {
180 return IsHorizontalAlignment() ? horizontal : vertical;
181 }
182
183 // Is the shelf's alignment horizontal?
184 bool IsHorizontalAlignment() const;
185
186 // Returns a ShelfLayoutManager on the display which has a launcher for
187 // given |window|. See RootWindowController::ForLauncher for more info.
188 static ShelfLayoutManager* ForLauncher(aura::Window* window);
189
159 private: 190 private:
160 class AutoHideEventFilter; 191 class AutoHideEventFilter;
161 class UpdateShelfObserver; 192 class UpdateShelfObserver;
162 friend class ash::ScreenAsh; 193 friend class ash::ScreenAsh;
163 friend class ShelfLayoutManagerTest; 194 friend class ShelfLayoutManagerTest;
164 195
165 struct TargetBounds { 196 struct TargetBounds {
166 TargetBounds(); 197 TargetBounds();
167 198
168 float opacity; 199 float opacity;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ShelfVisibilityState visibility_state) const; 258 ShelfVisibilityState visibility_state) const;
228 259
229 // Updates the hit test bounds override for launcher and status area. 260 // Updates the hit test bounds override for launcher and status area.
230 void UpdateHitTestBounds(); 261 void UpdateHitTestBounds();
231 262
232 // Returns true if |window| is a descendant of the shelf. 263 // Returns true if |window| is a descendant of the shelf.
233 bool IsShelfWindow(aura::Window* window); 264 bool IsShelfWindow(aura::Window* window);
234 265
235 int GetWorkAreaSize(const State& state, int size) const; 266 int GetWorkAreaSize(const State& state, int size) const;
236 267
237 int axis_position(int x, int y) const {
238 return alignment_ == SHELF_ALIGNMENT_BOTTOM ? y : x;
239 }
240
241 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from 268 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from
242 // our destructor. We avoid that as at the time we're deleted Shell is being 269 // our destructor. We avoid that as at the time we're deleted Shell is being
243 // deleted too. 270 // deleted too.
244 aura::RootWindow* root_window_; 271 aura::RootWindow* root_window_;
245 272
246 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf 273 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf
247 // again from SetChildBounds(). 274 // again from SetChildBounds().
248 bool in_layout_; 275 bool in_layout_;
249 276
250 // See description above setter. 277 // See description above setter.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Used to delay updating shelf background. 319 // Used to delay updating shelf background.
293 UpdateShelfObserver* update_shelf_observer_; 320 UpdateShelfObserver* update_shelf_observer_;
294 321
295 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); 322 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager);
296 }; 323 };
297 324
298 } // namespace internal 325 } // namespace internal
299 } // namespace ash 326 } // namespace ash
300 327
301 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ 328 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/wm/app_list_controller.cc ('k') | ash/wm/shelf_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698