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 "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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0)); | 70 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0)); |
71 | 71 |
72 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 72 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
73 int resource_id = error_->GetBubbleViewIconResourceID(); | 73 int resource_id = error_->GetBubbleViewIconResourceID(); |
74 scoped_ptr<views::ImageView> image_view(new views::ImageView()); | 74 scoped_ptr<views::ImageView> image_view(new views::ImageView()); |
75 image_view->SetImage(rb.GetImageNamed(resource_id).ToImageSkia()); | 75 image_view->SetImage(rb.GetImageNamed(resource_id).ToImageSkia()); |
76 | 76 |
77 string16 title_string(error_->GetBubbleViewTitle()); | 77 string16 title_string(error_->GetBubbleViewTitle()); |
78 scoped_ptr<views::Label> title_label(new views::Label(title_string)); | 78 scoped_ptr<views::Label> title_label(new views::Label(title_string)); |
79 title_label->SetMultiLine(true); | 79 title_label->SetMultiLine(true); |
80 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 80 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
81 title_label->SetFont(title_label->font().DeriveFont(1)); | 81 title_label->SetFont(title_label->font().DeriveFont(1)); |
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(views::Label::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::TextButton> accept_button( |
91 new views::NativeTextButton(this, accept_string)); | 91 new views::NativeTextButton(this, accept_string)); |
92 accept_button->SetIsDefault(true); | 92 accept_button->SetIsDefault(true); |
93 accept_button->set_tag(TAG_ACCEPT_BUTTON); | 93 accept_button->set_tag(TAG_ACCEPT_BUTTON); |
94 | 94 |
95 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); | 95 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); |
96 scoped_ptr<views::TextButton> cancel_button; | 96 scoped_ptr<views::TextButton> cancel_button; |
97 if (!cancel_string.empty()) { | 97 if (!cancel_string.empty()) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 void GlobalErrorBubbleView::WindowClosing() { | 164 void GlobalErrorBubbleView::WindowClosing() { |
165 if (error_) | 165 if (error_) |
166 error_->BubbleViewDidClose(browser_); | 166 error_->BubbleViewDidClose(browser_); |
167 } | 167 } |
168 | 168 |
169 void GlobalErrorBubbleView::CloseBubbleView() { | 169 void GlobalErrorBubbleView::CloseBubbleView() { |
170 GetWidget()->Close(); | 170 GetWidget()->Close(); |
171 } | 171 } |
OLD | NEW |