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

Side by Side Diff: ash/common/system/web_notification/web_notification_tray.cc

Issue 2099103002: Give Ash material design tray items the correct size and layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split shelf and tray constants Created 4 years, 5 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
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/shelf/app_list_button.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 #include "ash/common/system/web_notification/web_notification_tray.h" 5 #include "ash/common/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void SetUnreadCount(int unread_count) { 153 void SetUnreadCount(int unread_count) {
154 // base::FormatNumber doesn't convert to arabic numeric characters. 154 // base::FormatNumber doesn't convert to arabic numeric characters.
155 // TODO(mukai): use ICU to support conversion for such locales. 155 // TODO(mukai): use ICU to support conversion for such locales.
156 unread_count_ = unread_count; 156 unread_count_ = unread_count;
157 UpdateIconVisibility(); 157 UpdateIconVisibility();
158 } 158 }
159 159
160 protected: 160 protected:
161 // Overridden from views::ImageButton: 161 // Overridden from views::ImageButton:
162 gfx::Size GetPreferredSize() const override { 162 gfx::Size GetPreferredSize() const override {
163 return gfx::Size(kShelfItemHeight, kShelfItemHeight); 163 const int size = GetTrayConstant(TRAY_ITEM_HEIGHT_LEGACY);
164 return gfx::Size(size, size);
164 } 165 }
165 166
166 int GetHeightForWidth(int width) const override { 167 int GetHeightForWidth(int width) const override {
167 return GetPreferredSize().height(); 168 return GetPreferredSize().height();
168 } 169 }
169 170
170 private: 171 private:
171 void UpdateIconVisibility() { 172 void UpdateIconVisibility() {
172 if (unread_count_ == 0) { 173 if (unread_count_ == 0) {
173 if (!Contains(&no_unread_icon_)) { 174 if (!Contains(&no_unread_icon_)) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 530
530 message_center::MessageCenterBubble* 531 message_center::MessageCenterBubble*
531 WebNotificationTray::GetMessageCenterBubbleForTest() { 532 WebNotificationTray::GetMessageCenterBubbleForTest() {
532 if (!message_center_bubble()) 533 if (!message_center_bubble())
533 return NULL; 534 return NULL;
534 return static_cast<message_center::MessageCenterBubble*>( 535 return static_cast<message_center::MessageCenterBubble*>(
535 message_center_bubble()->bubble()); 536 message_center_bubble()->bubble());
536 } 537 }
537 538
538 } // namespace ash 539 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/shelf/app_list_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698