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

Unified Diff: ash/system/tray/tray_item_view.h

Issue 23112002: Fixing the gdrive sync item alignment to keep it centered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/tray/tray_item_view.h
diff --git a/ash/system/tray/tray_item_view.h b/ash/system/tray/tray_item_view.h
index e0d8ec4d5af6c0f2ed5cc1679b0232d4b0d337e5..10b16e414bf1ec2f6a1ab9078d6e88c00a11ae3d 100644
--- a/ash/system/tray/tray_item_view.h
+++ b/ash/system/tray/tray_item_view.h
@@ -6,9 +6,14 @@
#define ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_
#include "ash/ash_export.h"
+#include "ash/shell_observer.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/views/view.h"
+namespace aura {
+class RootWindow;
+}
+
namespace ui {
class SlideAnimation;
}
@@ -28,6 +33,7 @@ namespace internal {
// correctly when the visibility/size of the tray item changes. It also adds
// animation when showing/hiding the item in the tray.
class ASH_EXPORT TrayItemView : public views::View,
+ public ash::ShellObserver,
public ui::AnimationDelegate {
public:
explicit TrayItemView(SystemTrayItem* owner);
@@ -43,11 +49,23 @@ class ASH_EXPORT TrayItemView : public views::View,
views::Label* label() const { return label_; }
views::ImageView* image_view() const { return image_view_; }
+ enum AlignmentOverride {
+ AUTO,
+ HORIZONTAL,
+ VERTICAL
+ };
+
+ // Enforce a shelf alignment independent alignment for this item.
+ void SetAlignmentOverride(AlignmentOverride alignment_override);
+
// Overridden from views::View.
virtual void SetVisible(bool visible) OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual int GetHeightForWidth(int width) OVERRIDE;
+ // Overridden from ash::ShellObserver.
+ virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) OVERRIDE;
jennyz 2013/08/13 20:32:51 We already have UpdateAfterShelfAlignmentChange()
Mr4D (OOO till 08-26) 2013/08/13 21:25:01 Okay - as discussed - changed it now only in the o
+
protected:
// Makes sure the widget relayouts after the size/visibility of the view
// changes.
@@ -71,11 +89,18 @@ class ASH_EXPORT TrayItemView : public views::View,
virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
+ // Set the layout alignment of the view inside its parent from the shelf.
+ void SetLayoutAlignment();
+
SystemTrayItem* owner_;
scoped_ptr<ui::SlideAnimation> animation_;
views::Label* label_;
views::ImageView* image_view_;
+ // The alignment override - or |AUTO| if the shelf alignment should be used.
+ AlignmentOverride alignment_override_;
+
+
DISALLOW_COPY_AND_ASSIGN(TrayItemView);
};

Powered by Google App Engine
This is Rietveld 408576698