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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/app_list_controller.cc ('k') | ash/wm/shelf_layout_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/shelf_layout_manager.h
diff --git a/ash/wm/shelf_layout_manager.h b/ash/wm/shelf_layout_manager.h
index 2666e8c6fa120f89e17aa8d721c412c589e1d35d..0a4a018ad7ac02e1bb9999b2549c82ff2c4bc750 100644
--- a/ash/wm/shelf_layout_manager.h
+++ b/ash/wm/shelf_layout_manager.h
@@ -11,6 +11,7 @@
#include "ash/shell_observer.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
#include "base/observer_list.h"
#include "base/timer.h"
#include "ui/aura/layout_manager.h"
@@ -76,7 +77,7 @@ class ASH_EXPORT ShelfLayoutManager :
// Sets the alignment. Returns true if the alignment is changed. Otherwise,
// returns false.
bool SetAlignment(ShelfAlignment alignment);
- ShelfAlignment alignment() const { return alignment_; }
+ ShelfAlignment GetAlignment() const { return alignment_; }
void set_workspace_controller(WorkspaceController* controller) {
workspace_controller_ = controller;
@@ -156,6 +157,36 @@ class ASH_EXPORT ShelfLayoutManager :
virtual void OnWindowActivated(aura::Window* active,
aura::Window* old_active) OVERRIDE;
+ // TODO(harrym|oshima): These templates will be moved to
+ // new Shelf class.
+ // A helper function that provides a shortcut for choosing
+ // values specific to a shelf alignment.
+ template<typename T>
+ T SelectValueForShelfAlignment(T bottom, T left, T right) const {
+ switch (alignment_) {
+ case SHELF_ALIGNMENT_BOTTOM:
+ return bottom;
+ case SHELF_ALIGNMENT_LEFT:
+ return left;
+ case SHELF_ALIGNMENT_RIGHT:
+ return right;
+ }
+ NOTREACHED();
+ return right;
+ }
+
+ template<typename T>
+ T PrimaryAxisValue(T horizontal, T vertical) const {
+ return IsHorizontalAlignment() ? horizontal : vertical;
+ }
+
+ // Is the shelf's alignment horizontal?
+ bool IsHorizontalAlignment() const;
+
+ // Returns a ShelfLayoutManager on the display which has a launcher for
+ // given |window|. See RootWindowController::ForLauncher for more info.
+ static ShelfLayoutManager* ForLauncher(aura::Window* window);
+
private:
class AutoHideEventFilter;
class UpdateShelfObserver;
@@ -234,10 +265,6 @@ class ASH_EXPORT ShelfLayoutManager :
int GetWorkAreaSize(const State& state, int size) const;
- int axis_position(int x, int y) const {
- return alignment_ == SHELF_ALIGNMENT_BOTTOM ? y : x;
- }
-
// The RootWindow is cached so that we don't invoke Shell::GetInstance() from
// our destructor. We avoid that as at the time we're deleted Shell is being
// deleted too.
« 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