| 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, AsWeakPtr()))); |
| 106 | 109 |
| 107 base::string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); | 110 base::string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); |
| 108 scoped_ptr<views::LabelButton> cancel_button; | 111 scoped_ptr<views::LabelButton> cancel_button; |
| 109 if (!cancel_string.empty()) { | 112 if (!cancel_string.empty()) { |
| 110 cancel_button.reset(new views::LabelButton(this, cancel_string)); | 113 cancel_button.reset(new views::LabelButton(this, cancel_string)); |
| 111 cancel_button->SetStyle(views::Button::STYLE_BUTTON); | 114 cancel_button->SetStyle(views::Button::STYLE_BUTTON); |
| 112 cancel_button->set_tag(TAG_CANCEL_BUTTON); | 115 cancel_button->set_tag(TAG_CANCEL_BUTTON); |
| 113 } | 116 } |
| 114 | 117 |
| 115 views::GridLayout* layout = new views::GridLayout(this); | 118 views::GridLayout* layout = new views::GridLayout(this); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 error_->BubbleViewDidClose(browser_); | 196 error_->BubbleViewDidClose(browser_); |
| 194 } | 197 } |
| 195 | 198 |
| 196 bool GlobalErrorBubbleView::ShouldShowCloseButton() const { | 199 bool GlobalErrorBubbleView::ShouldShowCloseButton() const { |
| 197 return error_ && error_->ShouldShowCloseButton(); | 200 return error_ && error_->ShouldShowCloseButton(); |
| 198 } | 201 } |
| 199 | 202 |
| 200 void GlobalErrorBubbleView::CloseBubbleView() { | 203 void GlobalErrorBubbleView::CloseBubbleView() { |
| 201 GetWidget()->Close(); | 204 GetWidget()->Close(); |
| 202 } | 205 } |
| OLD | NEW |