| 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.h" | 8 #include "chrome/browser/ui/global_error.h" |
| 9 #include "chrome/browser/ui/global_error_service.h" | 9 #include "chrome/browser/ui/global_error_service.h" |
| 10 #include "chrome/browser/ui/global_error_service_factory.h" | 10 #include "chrome/browser/ui/global_error_service_factory.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 views::BubbleBorder::ArrowLocation location, | 62 views::BubbleBorder::ArrowLocation location, |
| 63 Browser* browser, | 63 Browser* browser, |
| 64 const base::WeakPtr<GlobalError>& error) | 64 const base::WeakPtr<GlobalError>& error) |
| 65 : BubbleDelegateView(anchor_view, location), | 65 : BubbleDelegateView(anchor_view, location), |
| 66 browser_(browser), | 66 browser_(browser), |
| 67 error_(error) { | 67 error_(error) { |
| 68 DCHECK(error_); | 68 DCHECK(error_); |
| 69 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 69 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 70 int resource_id = error_->GetBubbleViewIconResourceID(); | 70 int resource_id = error_->GetBubbleViewIconResourceID(); |
| 71 scoped_ptr<views::ImageView> image_view(new views::ImageView()); | 71 scoped_ptr<views::ImageView> image_view(new views::ImageView()); |
| 72 image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap()); | 72 image_view->SetImage(rb.GetImageNamed(resource_id).ToImageSkia()); |
| 73 | 73 |
| 74 string16 title_string(error_->GetBubbleViewTitle()); | 74 string16 title_string(error_->GetBubbleViewTitle()); |
| 75 scoped_ptr<views::Label> title_label(new views::Label(title_string)); | 75 scoped_ptr<views::Label> title_label(new views::Label(title_string)); |
| 76 title_label->SetMultiLine(true); | 76 title_label->SetMultiLine(true); |
| 77 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 77 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 78 title_label->SetFont(title_label->font().DeriveFont(1)); | 78 title_label->SetFont(title_label->font().DeriveFont(1)); |
| 79 | 79 |
| 80 string16 message_string(error_->GetBubbleViewMessage()); | 80 string16 message_string(error_->GetBubbleViewMessage()); |
| 81 views::Label* message_label = new views::Label(message_string); | 81 views::Label* message_label = new views::Label(message_string); |
| 82 message_label->SetMultiLine(true); | 82 message_label->SetMultiLine(true); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 void GlobalErrorBubbleView::WindowClosing() { | 167 void GlobalErrorBubbleView::WindowClosing() { |
| 168 if (error_) | 168 if (error_) |
| 169 error_->BubbleViewDidClose(browser_); | 169 error_->BubbleViewDidClose(browser_); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void GlobalErrorBubbleView::CloseBubbleView() { | 172 void GlobalErrorBubbleView::CloseBubbleView() { |
| 173 GetWidget()->Close(); | 173 GetWidget()->Close(); |
| 174 } | 174 } |
| OLD | NEW |