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

Side by Side Diff: ash/system/user/tray_user.cc

Issue 13925006: Declares GetHeightForWidth() for those who need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/tray_item_view.cc ('k') | no next file » | 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/system/user/tray_user.h" 5 #include "ash/system/user/tray_user.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 class UserView : public views::View, 165 class UserView : public views::View,
166 public views::ButtonListener { 166 public views::ButtonListener {
167 public: 167 public:
168 explicit UserView(SystemTrayItem* owner, ash::user::LoginStatus login); 168 explicit UserView(SystemTrayItem* owner, ash::user::LoginStatus login);
169 virtual ~UserView(); 169 virtual ~UserView();
170 170
171 private: 171 private:
172 // Overridden from views::View. 172 // Overridden from views::View.
173 virtual gfx::Size GetPreferredSize() OVERRIDE; 173 virtual gfx::Size GetPreferredSize() OVERRIDE;
174 virtual int GetHeightForWidth(int width) OVERRIDE;
174 virtual void Layout() OVERRIDE; 175 virtual void Layout() OVERRIDE;
175 176
176 // Overridden from views::ButtonListener. 177 // Overridden from views::ButtonListener.
177 virtual void ButtonPressed(views::Button* sender, 178 virtual void ButtonPressed(views::Button* sender,
178 const ui::Event& event) OVERRIDE; 179 const ui::Event& event) OVERRIDE;
179 180
180 void AddLogoutButton(ash::user::LoginStatus login); 181 void AddLogoutButton(ash::user::LoginStatus login);
181 void AddUserCard(SystemTrayItem* owner, ash::user::LoginStatus login); 182 void AddUserCard(SystemTrayItem* owner, ash::user::LoginStatus login);
182 183
183 views::View* user_card_; 184 views::View* user_card_;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 gfx::Size size = views::View::GetPreferredSize(); 436 gfx::Size size = views::View::GetPreferredSize();
436 if (!user_card_) { 437 if (!user_card_) {
437 // Make sure the default user view item is at least as tall as the other 438 // Make sure the default user view item is at least as tall as the other
438 // items. 439 // items.
439 size.set_height(std::max(size.height(), 440 size.set_height(std::max(size.height(),
440 kTrayPopupItemHeight + GetInsets().height())); 441 kTrayPopupItemHeight + GetInsets().height()));
441 } 442 }
442 return size; 443 return size;
443 } 444 }
444 445
446 int UserView::GetHeightForWidth(int width) {
447 return GetPreferredSize().height();
448 }
449
445 void UserView::Layout() { 450 void UserView::Layout() {
446 gfx::Rect contents_area(GetContentsBounds()); 451 gfx::Rect contents_area(GetContentsBounds());
447 if (user_card_ && logout_button_) { 452 if (user_card_ && logout_button_) {
448 // Give the logout button the space it requests. 453 // Give the logout button the space it requests.
449 gfx::Rect logout_area = contents_area; 454 gfx::Rect logout_area = contents_area;
450 logout_area.ClampToCenteredSize(logout_button_->GetPreferredSize()); 455 logout_area.ClampToCenteredSize(logout_button_->GetPreferredSize());
451 logout_area.set_x(contents_area.right() - logout_area.width()); 456 logout_area.set_x(contents_area.right() - logout_area.width());
452 logout_button_->SetBoundsRect(logout_area); 457 logout_button_->SetBoundsRect(logout_area);
453 458
454 // Give the remaining space to the user card. 459 // Give the remaining space to the user card.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // Check for null to avoid crbug.com/150944. 667 // Check for null to avoid crbug.com/150944.
663 if (avatar_) { 668 if (avatar_) {
664 avatar_->SetImage( 669 avatar_->SetImage(
665 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), 670 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(),
666 gfx::Size(kUserIconSize, kUserIconSize)); 671 gfx::Size(kUserIconSize, kUserIconSize));
667 } 672 }
668 } 673 }
669 674
670 } // namespace internal 675 } // namespace internal
671 } // namespace ash 676 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_item_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698