OLD | NEW |
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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/global_error/global_error.h" | 10 #include "chrome/browser/ui/global_error/global_error.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 message_labels.push_back(message_label); | 95 message_labels.push_back(message_label); |
96 } | 96 } |
97 | 97 |
98 base::string16 accept_string(error_->GetBubbleViewAcceptButtonLabel()); | 98 base::string16 accept_string(error_->GetBubbleViewAcceptButtonLabel()); |
99 scoped_ptr<views::LabelButton> accept_button( | 99 scoped_ptr<views::LabelButton> accept_button( |
100 new views::LabelButton(this, accept_string)); | 100 new views::LabelButton(this, accept_string)); |
101 accept_button->SetStyle(views::Button::STYLE_BUTTON); | 101 accept_button->SetStyle(views::Button::STYLE_BUTTON); |
102 accept_button->SetIsDefault(true); | 102 accept_button->SetIsDefault(true); |
103 accept_button->set_tag(TAG_ACCEPT_BUTTON); | 103 accept_button->set_tag(TAG_ACCEPT_BUTTON); |
104 if (error_->ShouldAddElevationIconToAcceptButton()) | 104 if (error_->ShouldAddElevationIconToAcceptButton()) |
105 elevation_icon_setter_.reset(new ElevationIconSetter(accept_button.get())); | 105 elevation_icon_setter_.reset( |
| 106 new ElevationIconSetter( |
| 107 accept_button.get(), |
| 108 base::Bind(&GlobalErrorBubbleView::SizeToContents, |
| 109 base::Unretained(this)))); |
106 | 110 |
107 base::string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); | 111 base::string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); |
108 scoped_ptr<views::LabelButton> cancel_button; | 112 scoped_ptr<views::LabelButton> cancel_button; |
109 if (!cancel_string.empty()) { | 113 if (!cancel_string.empty()) { |
110 cancel_button.reset(new views::LabelButton(this, cancel_string)); | 114 cancel_button.reset(new views::LabelButton(this, cancel_string)); |
111 cancel_button->SetStyle(views::Button::STYLE_BUTTON); | 115 cancel_button->SetStyle(views::Button::STYLE_BUTTON); |
112 cancel_button->set_tag(TAG_CANCEL_BUTTON); | 116 cancel_button->set_tag(TAG_CANCEL_BUTTON); |
113 } | 117 } |
114 | 118 |
115 views::GridLayout* layout = new views::GridLayout(this); | 119 views::GridLayout* layout = new views::GridLayout(this); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 error_->BubbleViewDidClose(browser_); | 197 error_->BubbleViewDidClose(browser_); |
194 } | 198 } |
195 | 199 |
196 bool GlobalErrorBubbleView::ShouldShowCloseButton() const { | 200 bool GlobalErrorBubbleView::ShouldShowCloseButton() const { |
197 return error_ && error_->ShouldShowCloseButton(); | 201 return error_ && error_->ShouldShowCloseButton(); |
198 } | 202 } |
199 | 203 |
200 void GlobalErrorBubbleView::CloseBubbleView() { | 204 void GlobalErrorBubbleView::CloseBubbleView() { |
201 GetWidget()->Close(); | 205 GetWidget()->Close(); |
202 } | 206 } |
OLD | NEW |