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

Side by Side Diff: chrome/browser/ui/views/avatar_menu_bubble_view.cc

Issue 11819035: Adjust fonts (part of 137349): use standard font sizes in AvatarMenuBubble (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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 | « no previous file | 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 "chrome/browser/ui/views/avatar_menu_bubble_view.h" 5 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/profiles/avatar_menu_model.h" 12 #include "chrome/browser/profiles/avatar_menu_model.h"
13 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
14 #include "chrome/browser/profiles/profile_info_util.h" 14 #include "chrome/browser/profiles/profile_info_util.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_commands.h" 17 #include "chrome/browser/ui/browser_commands.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/font.h"
24 #include "ui/gfx/image/canvas_image_source.h" 23 #include "ui/gfx/image/canvas_image_source.h"
25 #include "ui/gfx/image/image.h" 24 #include "ui/gfx/image/image.h"
26 #include "ui/views/controls/button/custom_button.h" 25 #include "ui/views/controls/button/custom_button.h"
27 #include "ui/views/controls/button/image_button.h" 26 #include "ui/views/controls/button/image_button.h"
28 #include "ui/views/controls/image_view.h" 27 #include "ui/views/controls/image_view.h"
29 #include "ui/views/controls/label.h" 28 #include "ui/views/controls/label.h"
30 #include "ui/views/controls/link.h" 29 #include "ui/views/controls/link.h"
31 #include "ui/views/controls/separator.h" 30 #include "ui/views/controls/separator.h"
32 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
33 32
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 image_view_ = new ProfileImageView(); 240 image_view_ = new ProfileImageView();
242 gfx::ImageSkia profile_icon = *item_.icon.ToImageSkia(); 241 gfx::ImageSkia profile_icon = *item_.icon.ToImageSkia();
243 if (item_.active) 242 if (item_.active)
244 image_view_->SetImage(GetBadgedIcon(profile_icon)); 243 image_view_->SetImage(GetBadgedIcon(profile_icon));
245 else 244 else
246 image_view_->SetImage(profile_icon); 245 image_view_->SetImage(profile_icon);
247 AddChildView(image_view_); 246 AddChildView(image_view_);
248 247
249 // Add a label to show the profile name. 248 // Add a label to show the profile name.
250 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 249 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
251 const gfx::Font base_font = rb.GetFont(ui::ResourceBundle::BaseFont);
252 const int style = item_.active ? gfx::Font::BOLD : 0;
253 const int kNameFontDelta = 1;
254 name_label_ = new views::Label(item_.name, 250 name_label_ = new views::Label(item_.name,
255 base_font.DeriveFont(kNameFontDelta, style)); 251 rb.GetFont(item_.active ?
252 ui::ResourceBundle::BoldFont :
253 ui::ResourceBundle::BaseFont));
256 name_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 254 name_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
257 AddChildView(name_label_); 255 AddChildView(name_label_);
258 256
259 // Add a label to show the sync state. 257 // Add a label to show the sync state.
260 const int kStateFontDelta = -1;
261 sync_state_label_ = new views::Label(item_.sync_state); 258 sync_state_label_ = new views::Label(item_.sync_state);
262 if (item_.signed_in) 259 if (item_.signed_in)
263 sync_state_label_->SetElideBehavior(views::Label::ELIDE_AS_EMAIL); 260 sync_state_label_->SetElideBehavior(views::Label::ELIDE_AS_EMAIL);
264 sync_state_label_->SetFont(base_font.DeriveFont(kStateFontDelta)); 261 sync_state_label_->SetFont(rb.GetFont(ui::ResourceBundle::SmallFont));
265 sync_state_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 262 sync_state_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
266 sync_state_label_->SetEnabled(false); 263 sync_state_label_->SetEnabled(false);
267 AddChildView(sync_state_label_); 264 AddChildView(sync_state_label_);
268 265
269 // Add an edit profile link. 266 // Add an edit profile link.
270 edit_link_ = new EditProfileLink( 267 edit_link_ = new EditProfileLink(
271 l10n_util::GetStringUTF16(IDS_PROFILES_EDIT_PROFILE_LINK), this); 268 l10n_util::GetStringUTF16(IDS_PROFILES_EDIT_PROFILE_LINK), this);
272 edit_link_->set_listener(parent); 269 edit_link_->set_listener(parent);
273 edit_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 270 edit_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
274 edit_link_->SetHasFocusBorder(true); 271 edit_link_->SetHasFocusBorder(true);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 add_profile_link_->set_listener(this); 583 add_profile_link_->set_listener(this);
587 add_profile_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 584 add_profile_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
588 add_profile_link_->SetBackgroundColor(color()); 585 add_profile_link_->SetBackgroundColor(color());
589 AddChildView(add_profile_link_); 586 AddChildView(add_profile_link_);
590 587
591 // If the bubble has already been shown then resize and reposition the bubble. 588 // If the bubble has already been shown then resize and reposition the bubble.
592 Layout(); 589 Layout();
593 if (GetBubbleFrameView()) 590 if (GetBubbleFrameView())
594 SizeToContents(); 591 SizeToContents();
595 } 592 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698