| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 GlobalErrorBubbleView::GlobalErrorBubbleView( | 60 GlobalErrorBubbleView::GlobalErrorBubbleView( |
| 61 views::View* anchor_view, | 61 views::View* anchor_view, |
| 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 // Compensate for built-in vertical padding in the anchor view's image. | 68 // Compensate for built-in vertical padding in the anchor view's image. |
| 69 set_anchor_insets( | 69 set_anchor_view_insets( |
| 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); |
| (...skipping 82 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 |