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

Side by Side Diff: chrome/browser/ui/views/global_error_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/global_error_bubble_view.h" 5 #include "chrome/browser/ui/views/global_error_bubble_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/global_error/global_error.h" 8 #include "chrome/browser/ui/global_error/global_error.h"
9 #include "chrome/browser/ui/global_error/global_error_service.h" 9 #include "chrome/browser/ui/global_error/global_error_service.h"
10 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 10 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 11 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/toolbar_view.h" 12 #include "chrome/browser/ui/views/toolbar_view.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
15 #include "ui/views/controls/button/text_button.h" 15 #include "ui/views/controls/button/label_button.h"
16 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
17 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
18 #include "ui/views/layout/grid_layout.h" 18 #include "ui/views/layout/grid_layout.h"
19 #include "ui/views/layout/layout_constants.h" 19 #include "ui/views/layout/layout_constants.h"
20 20
21 namespace { 21 namespace {
22 22
23 enum { 23 enum {
24 TAG_ACCEPT_BUTTON = 1, 24 TAG_ACCEPT_BUTTON = 1,
25 TAG_CANCEL_BUTTON, 25 TAG_CANCEL_BUTTON,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 80 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
81 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 81 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
82 82
83 string16 message_string(error_->GetBubbleViewMessage()); 83 string16 message_string(error_->GetBubbleViewMessage());
84 views::Label* message_label = new views::Label(message_string); 84 views::Label* message_label = new views::Label(message_string);
85 message_label->SetMultiLine(true); 85 message_label->SetMultiLine(true);
86 message_label->SizeToFit(kMaxBubbleViewWidth); 86 message_label->SizeToFit(kMaxBubbleViewWidth);
87 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 87 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
88 88
89 string16 accept_string(error_->GetBubbleViewAcceptButtonLabel()); 89 string16 accept_string(error_->GetBubbleViewAcceptButtonLabel());
90 scoped_ptr<views::TextButton> accept_button( 90 scoped_ptr<views::LabelButton> accept_button(
91 new views::NativeTextButton(this, accept_string)); 91 new views::LabelButton(this, accept_string));
92 accept_button->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
92 accept_button->SetIsDefault(true); 93 accept_button->SetIsDefault(true);
93 accept_button->set_tag(TAG_ACCEPT_BUTTON); 94 accept_button->set_tag(TAG_ACCEPT_BUTTON);
94 95
95 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); 96 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel());
96 scoped_ptr<views::TextButton> cancel_button; 97 scoped_ptr<views::LabelButton> cancel_button;
97 if (!cancel_string.empty()) { 98 if (!cancel_string.empty()) {
98 cancel_button.reset(new views::NativeTextButton(this, cancel_string)); 99 cancel_button.reset(new views::LabelButton(this, cancel_string));
100 cancel_button->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
99 cancel_button->set_tag(TAG_CANCEL_BUTTON); 101 cancel_button->set_tag(TAG_CANCEL_BUTTON);
100 } 102 }
101 103
102 views::GridLayout* layout = new views::GridLayout(this); 104 views::GridLayout* layout = new views::GridLayout(this);
103 SetLayoutManager(layout); 105 SetLayoutManager(layout);
104 layout->SetInsets(0, 0, kLayoutBottomPadding, 0); 106 layout->SetInsets(0, 0, kLayoutBottomPadding, 0);
105 107
106 // Top row, icon and title. 108 // Top row, icon and title.
107 views::ColumnSet* cs = layout->AddColumnSet(0); 109 views::ColumnSet* cs = layout->AddColumnSet(0);
108 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 110 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 164 }
163 165
164 void GlobalErrorBubbleView::WindowClosing() { 166 void GlobalErrorBubbleView::WindowClosing() {
165 if (error_) 167 if (error_)
166 error_->BubbleViewDidClose(browser_); 168 error_->BubbleViewDidClose(browser_);
167 } 169 }
168 170
169 void GlobalErrorBubbleView::CloseBubbleView() { 171 void GlobalErrorBubbleView::CloseBubbleView() {
170 GetWidget()->Close(); 172 GetWidget()->Close();
171 } 173 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/fullscreen_exit_bubble_views.cc ('k') | chrome/browser/ui/views/location_bar/zoom_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698