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

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

Issue 11698005: Adjust fonts (part of 137349): use standard font sizes in chrome/browser/ui/views (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: crbug.com/166679 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
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/password_generation_bubble_view.h" 5 #include "chrome/browser/ui/views/password_generation_bubble_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autofill/password_generator.h" 8 #include "chrome/browser/autofill/password_generator.h"
9 #include "chrome/browser/password_manager/password_manager.h" 9 #include "chrome/browser/password_manager/password_manager.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 17 matching lines...) Expand all
28 #include "ui/views/controls/link.h" 28 #include "ui/views/controls/link.h"
29 #include "ui/views/controls/textfield/textfield.h" 29 #include "ui/views/controls/textfield/textfield.h"
30 #include "ui/views/layout/layout_constants.h" 30 #include "ui/views/layout/layout_constants.h"
31 31
32 namespace { 32 namespace {
33 // Constants for PasswordGenerationBubbleView. 33 // Constants for PasswordGenerationBubbleView.
34 const int kBubbleMargin = 9; 34 const int kBubbleMargin = 9;
35 const int kButtonHorizontalSpacing = 4; 35 const int kButtonHorizontalSpacing = 4;
36 const int kButtonWidth = 65; 36 const int kButtonWidth = 65;
37 const int kDefaultTextFieldChars = 18; 37 const int kDefaultTextFieldChars = 18;
38 const int kTitleLabelVerticalOffset = -3; 38 const int kTitleLabelVerticalOffset = -1;
39 const int kVerticalPadding = 8; 39 const int kVerticalPadding = 8;
40 40
41 // Constants for Text fieldWrapper. 41 // Constants for Text fieldWrapper.
42 const int kTextfieldHorizontalPadding = 2; 42 const int kTextfieldHorizontalPadding = 2;
43 const int kTextfieldVerticalPadding = 3; 43 const int kTextfieldVerticalPadding = 3;
44 const int kWrapperBorderSize = 1; 44 const int kWrapperBorderSize = 1;
45 45
46 // This class handles layout so that it looks like a Textfield and ImageButton 46 // This class handles layout so that it looks like a Textfield and ImageButton
47 // are part of one logical textfield with the button on the right side of the 47 // are part of one logical textfield with the button on the right side of the
48 // field. It also assumes that the textfield is already sized appropriately 48 // field. It also assumes that the textfield is already sized appropriately
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 theme_provider_(theme_provider) {} 141 theme_provider_(theme_provider) {}
142 142
143 PasswordGenerationBubbleView::~PasswordGenerationBubbleView() {} 143 PasswordGenerationBubbleView::~PasswordGenerationBubbleView() {}
144 144
145 void PasswordGenerationBubbleView::Init() { 145 void PasswordGenerationBubbleView::Init() {
146 set_margins(gfx::Insets(kBubbleMargin, kBubbleMargin, 146 set_margins(gfx::Insets(kBubbleMargin, kBubbleMargin,
147 kBubbleMargin, kBubbleMargin)); 147 kBubbleMargin, kBubbleMargin));
148 148
149 // TODO(gcasto): Localize text after we have finalized the UI. 149 // TODO(gcasto): Localize text after we have finalized the UI.
150 // crbug.com/118062. 150 // crbug.com/118062.
151 gfx::Font label_font = 151 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
152 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
153 label_font = label_font.DeriveFont(2);
154 title_label_ = new views::Label(ASCIIToUTF16("Password Suggestion"), 152 title_label_ = new views::Label(ASCIIToUTF16("Password Suggestion"),
155 label_font); 153 rb.GetFont(ui::ResourceBundle::MediumFont));
156 AddChildView(title_label_); 154 AddChildView(title_label_);
157 155
158 regenerate_button_ = new views::ImageButton(this); 156 regenerate_button_ = new views::ImageButton(this);
159 regenerate_button_->SetImage( 157 regenerate_button_->SetImage(
160 views::CustomButton::STATE_NORMAL, 158 views::CustomButton::STATE_NORMAL,
161 theme_provider_->GetImageSkiaNamed(IDR_RELOAD_DIMMED)); 159 theme_provider_->GetImageSkiaNamed(IDR_RELOAD_DIMMED));
162 regenerate_button_->SetImage( 160 regenerate_button_->SetImage(
163 views::CustomButton::STATE_HOVERED, 161 views::CustomButton::STATE_HOVERED,
164 theme_provider_->GetImageSkiaNamed(IDR_RELOAD)); 162 theme_provider_->GetImageSkiaNamed(IDR_RELOAD));
165 regenerate_button_->SetImage( 163 regenerate_button_->SetImage(
166 views::CustomButton::STATE_PRESSED, 164 views::CustomButton::STATE_PRESSED,
167 theme_provider_->GetImageSkiaNamed(IDR_RELOAD)); 165 theme_provider_->GetImageSkiaNamed(IDR_RELOAD));
168 166
169 textfield_ = new views::Textfield(); 167 textfield_ = new views::Textfield();
170 gfx::Font textfield_font =
171 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
172 textfield_font = textfield_font.DeriveFont(2, gfx::Font::BOLD);
173 textfield_->SetFont(textfield_font);
174 textfield_->set_default_width_in_chars(kDefaultTextFieldChars); 168 textfield_->set_default_width_in_chars(kDefaultTextFieldChars);
175 textfield_->SetText(ASCIIToUTF16(password_generator_->Generate())); 169 textfield_->SetText(ASCIIToUTF16(password_generator_->Generate()));
176 170
177 textfield_wrapper_ = new TextfieldWrapper(textfield_, 171 textfield_wrapper_ = new TextfieldWrapper(textfield_,
178 regenerate_button_); 172 regenerate_button_);
179 AddChildView(textfield_wrapper_); 173 AddChildView(textfield_wrapper_);
180 174
181 accept_button_ = new views::NativeTextButton(this, 175 accept_button_ = new views::NativeTextButton(this,
182 ASCIIToUTF16("Try it")); 176 ASCIIToUTF16("Try it"));
183 AddChildView(accept_button_); 177 AddChildView(accept_button_);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 220 }
227 if (sender == regenerate_button_) { 221 if (sender == regenerate_button_) {
228 textfield_->SetText( 222 textfield_->SetText(
229 ASCIIToUTF16(password_generator_->Generate())); 223 ASCIIToUTF16(password_generator_->Generate()));
230 } 224 }
231 } 225 }
232 226
233 views::View* PasswordGenerationBubbleView::GetInitiallyFocusedView() { 227 views::View* PasswordGenerationBubbleView::GetInitiallyFocusedView() {
234 return textfield_; 228 return textfield_;
235 } 229 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/global_error_bubble_view.cc ('k') | chrome/browser/ui/views/sad_tab_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698