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

Unified Diff: ash/system/tray/system_tray.cc

Issue 9969068: ash: Animate changes in the uber tray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/network/tray_network.cc ('k') | ash/system/tray/system_tray_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 2ce03de1d0f18250efbf7d0d9b1467cf5ad73642..5870e5500c0d8610897fd92661fbd4bd1c3d3ad5 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -58,64 +58,13 @@ const int kShadowHeight = 3;
const int kLeftPadding = 4;
const int kBottomLineHeight = 1;
-const int kTrayIconHeight = 29;
-
const SkColor kShadowColor = SkColorSetARGB(25, 0, 0, 0);
const SkColor kTrayBackgroundAlpha = 100;
const SkColor kTrayBackgroundHoverAlpha = 150;
-// Container for items in the tray. It makes sure the widget is updated
-// correctly when the visibility/size of the tray item changes.
-// TODO: setup animation.
-class TrayItemContainer : public views::View {
- public:
- explicit TrayItemContainer(views::View* view) : child_(view) {
- AddChildView(child_);
- SetVisible(child_->visible());
- }
-
- virtual ~TrayItemContainer() {}
-
- private:
- // Makes sure the widget relayouts after the size/visibility of the view
- // changes.
- void ApplyChange() {
- // Forcing the widget to the new size is sufficient. The positing is taken
- // care of by the layout manager (ShelfLayoutManager).
- GetWidget()->SetSize(GetWidget()->GetContentsView()->GetPreferredSize());
- }
-
- // Overridden from views::View.
- virtual void Layout() {
- child_->SetBoundsRect(gfx::Rect(size()));
- }
-
- virtual gfx::Size GetPreferredSize() OVERRIDE {
- gfx::Size size = child_->GetPreferredSize();
- size.set_height(kTrayIconHeight);
- return size;
- }
-
- virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE {
- ApplyChange();
- }
-
- virtual void ChildVisibilityChanged(views::View* child) OVERRIDE {
- if (visible() == child_->visible())
- return;
- SetVisible(child_->visible());
- ApplyChange();
- }
-
- views::View* child_;
-
- DISALLOW_COPY_AND_ASSIGN(TrayItemContainer);
-};
-
// A view with some special behaviour for tray items in the popup:
// - changes background color on hover.
-// - TODO: accessibility
class TrayPopupItemContainer : public views::View {
public:
explicit TrayPopupItemContainer(views::View* view) : hover_(false) {
@@ -499,7 +448,7 @@ void SystemTray::AddTrayItem(SystemTrayItem* item) {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus());
if (tray_item) {
- container_->AddChildViewAt(new TrayItemContainer(tray_item), 0);
+ container_->AddChildViewAt(tray_item, 0);
PreferredSizeChanged();
}
}
@@ -558,7 +507,7 @@ void SystemTray::UpdateAfterLoginStatusChange(user::LoginStatus login_status) {
++it) {
views::View* view = (*it)->CreateTrayView(login_status);
if (view)
- container_->AddChildViewAt(new TrayItemContainer(view), 0);
+ container_->AddChildViewAt(view, 0);
}
SetVisible(true);
PreferredSizeChanged();
« no previous file with comments | « ash/system/network/tray_network.cc ('k') | ash/system/tray/system_tray_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698