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

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

Issue 13584010: views: Migrate the cases of "new .*NativeTextButton(" to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: back out the changes to one_click_signin_bubble_view.* 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
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/password_manager/password_manager.h" 8 #include "chrome/browser/password_manager/password_manager.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "components/autofill/browser/password_generator.h" 12 #include "components/autofill/browser/password_generator.h"
13 #include "components/autofill/common/autofill_messages.h" 13 #include "components/autofill/common/autofill_messages.h"
14 #include "components/autofill/common/password_generation_util.h" 14 #include "components/autofill/common/password_generation_util.h"
15 #include "content/public/browser/page_navigator.h" 15 #include "content/public/browser/page_navigator.h"
16 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.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 "third_party/skia/include/core/SkPaint.h" 20 #include "third_party/skia/include/core/SkPaint.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/base/theme_provider.h" 23 #include "ui/base/theme_provider.h"
24 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
25 #include "ui/views/border.h" 25 #include "ui/views/border.h"
26 #include "ui/views/controls/button/image_button.h" 26 #include "ui/views/controls/button/image_button.h"
27 #include "ui/views/controls/button/text_button.h" 27 #include "ui/views/controls/button/label_button.h"
28 #include "ui/views/controls/label.h" 28 #include "ui/views/controls/label.h"
29 #include "ui/views/controls/link.h" 29 #include "ui/views/controls/link.h"
30 #include "ui/views/controls/textfield/textfield.h" 30 #include "ui/views/controls/textfield/textfield.h"
31 #include "ui/views/layout/layout_constants.h" 31 #include "ui/views/layout/layout_constants.h"
32 32
33 namespace { 33 namespace {
34 // Constants for PasswordGenerationBubbleView. 34 // Constants for PasswordGenerationBubbleView.
35 const int kBubbleMargin = 9; 35 const int kBubbleMargin = 9;
36 const int kButtonHorizontalSpacing = 4; 36 const int kButtonHorizontalSpacing = 4;
37 const int kButtonWidth = 65; 37 const int kButtonWidth = 65;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 textfield_ = new views::Textfield(); 169 textfield_ = new views::Textfield();
170 textfield_->set_default_width_in_chars(kDefaultTextFieldChars); 170 textfield_->set_default_width_in_chars(kDefaultTextFieldChars);
171 textfield_->SetText(ASCIIToUTF16(password_generator_->Generate())); 171 textfield_->SetText(ASCIIToUTF16(password_generator_->Generate()));
172 textfield_->SetController(this); 172 textfield_->SetController(this);
173 173
174 textfield_wrapper_ = new TextfieldWrapper(textfield_, 174 textfield_wrapper_ = new TextfieldWrapper(textfield_,
175 regenerate_button_); 175 regenerate_button_);
176 AddChildView(textfield_wrapper_); 176 AddChildView(textfield_wrapper_);
177 177
178 accept_button_ = new views::NativeTextButton( 178 accept_button_ = new views::LabelButton(
179 this, 179 this,
180 l10n_util::GetStringUTF16(IDS_PASSWORD_GENERATION_BUTTON_TEXT)); 180 l10n_util::GetStringUTF16(IDS_PASSWORD_GENERATION_BUTTON_TEXT));
181 accept_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
181 AddChildView(accept_button_); 182 AddChildView(accept_button_);
182 } 183 }
183 184
184 void PasswordGenerationBubbleView::Layout() { 185 void PasswordGenerationBubbleView::Layout() {
185 // We have the title label shifted up to make the borders look more uniform. 186 // We have the title label shifted up to make the borders look more uniform.
186 title_label_->SetPosition(gfx::Point(0, kTitleLabelVerticalOffset)); 187 title_label_->SetPosition(gfx::Point(0, kTitleLabelVerticalOffset));
187 title_label_->SizeToPreferredSize(); 188 title_label_->SizeToPreferredSize();
188 189
189 int y = title_label_->GetPreferredSize().height() + kVerticalPadding; 190 int y = title_label_->GetPreferredSize().height() + kVerticalPadding;
190 191
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return false; 242 return false;
242 } 243 }
243 244
244 views::View* PasswordGenerationBubbleView::GetInitiallyFocusedView() { 245 views::View* PasswordGenerationBubbleView::GetInitiallyFocusedView() {
245 return textfield_; 246 return textfield_;
246 } 247 }
247 248
248 void PasswordGenerationBubbleView::WindowClosing() { 249 void PasswordGenerationBubbleView::WindowClosing() {
249 password_generation::LogUserActions(actions_); 250 password_generation::LogUserActions(actions_);
250 } 251 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/password_generation_bubble_view.h ('k') | chrome/browser/ui/views/speech_recognition_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698