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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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/user/rounded_image_view.cc ('k') | ash/system/user/user_view.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/user_card_view.h" 5 #include "ash/system/user/user_card_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/session/session_state_delegate.h" 10 #include "ash/session/session_state_delegate.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // contains a link. 124 // contains a link.
125 class PublicAccountUserDetails : public views::View, 125 class PublicAccountUserDetails : public views::View,
126 public views::LinkListener { 126 public views::LinkListener {
127 public: 127 public:
128 PublicAccountUserDetails(int max_width); 128 PublicAccountUserDetails(int max_width);
129 virtual ~PublicAccountUserDetails(); 129 virtual ~PublicAccountUserDetails();
130 130
131 private: 131 private:
132 // Overridden from views::View. 132 // Overridden from views::View.
133 virtual void Layout() OVERRIDE; 133 virtual void Layout() OVERRIDE;
134 virtual gfx::Size GetPreferredSize() OVERRIDE; 134 virtual gfx::Size GetPreferredSize() const OVERRIDE;
135 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 135 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
136 136
137 // Overridden from views::LinkListener. 137 // Overridden from views::LinkListener.
138 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 138 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
139 139
140 // Calculate a preferred size that ensures the label text and the following 140 // Calculate a preferred size that ensures the label text and the following
141 // link do not wrap over more than three lines in total for aesthetic reasons 141 // link do not wrap over more than three lines in total for aesthetic reasons
142 // if possible. 142 // if possible.
143 void CalculatePreferredSize(int max_allowed_width); 143 void CalculatePreferredSize(int max_allowed_width);
144 144
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 position.set_y(position.y() - learn_more_->GetInsets().top()); 253 position.set_y(position.y() - learn_more_->GetInsets().top());
254 gfx::Rect learn_more_bounds(position, link_size); 254 gfx::Rect learn_more_bounds(position, link_size);
255 learn_more_bounds.Intersect(contents_area); 255 learn_more_bounds.Intersect(contents_area);
256 if (base::i18n::IsRTL()) { 256 if (base::i18n::IsRTL()) {
257 const gfx::Insets insets = GetInsets(); 257 const gfx::Insets insets = GetInsets();
258 learn_more_bounds.Offset(insets.right() - insets.left(), 0); 258 learn_more_bounds.Offset(insets.right() - insets.left(), 0);
259 } 259 }
260 learn_more_->SetBoundsRect(learn_more_bounds); 260 learn_more_->SetBoundsRect(learn_more_bounds);
261 } 261 }
262 262
263 gfx::Size PublicAccountUserDetails::GetPreferredSize() { 263 gfx::Size PublicAccountUserDetails::GetPreferredSize() const {
264 return preferred_size_; 264 return preferred_size_;
265 } 265 }
266 266
267 void PublicAccountUserDetails::OnPaint(gfx::Canvas* canvas) { 267 void PublicAccountUserDetails::OnPaint(gfx::Canvas* canvas) {
268 for (ScopedVector<gfx::RenderText>::const_iterator it = lines_.begin(); 268 for (ScopedVector<gfx::RenderText>::const_iterator it = lines_.begin();
269 it != lines_.end(); 269 it != lines_.end();
270 ++it) { 270 ++it) {
271 (*it)->Draw(canvas); 271 (*it)->Draw(canvas);
272 } 272 }
273 views::View::OnPaint(canvas); 273 views::View::OnPaint(canvas);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 content::BrowserContext* context = 468 content::BrowserContext* context =
469 delegate->GetBrowserContextByIndex(multiprofile_index); 469 delegate->GetBrowserContextByIndex(multiprofile_index);
470 icon->SetImage(delegate->GetUserInfo(context)->GetImage(), 470 icon->SetImage(delegate->GetUserInfo(context)->GetImage(),
471 gfx::Size(kTrayAvatarSize, kTrayAvatarSize)); 471 gfx::Size(kTrayAvatarSize, kTrayAvatarSize));
472 } 472 }
473 return icon; 473 return icon;
474 } 474 }
475 475
476 } // namespace tray 476 } // namespace tray
477 } // namespace ash 477 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/user/rounded_image_view.cc ('k') | ash/system/user/user_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698