| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "chrome/browser/ui/views/toolbar_view.h" | 10 #include "chrome/browser/ui/views/toolbar_view.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // The vertical offset of the wrench bubble from the wrench menu button. | 32 // The vertical offset of the wrench bubble from the wrench menu button. |
| 33 const int kWrenchBubblePointOffsetY = -6; | 33 const int kWrenchBubblePointOffsetY = -6; |
| 34 | 34 |
| 35 const int kLayoutBottomPadding = 2; | 35 const int kLayoutBottomPadding = 2; |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 GlobalErrorBubbleView::GlobalErrorBubbleView( | 39 GlobalErrorBubbleView::GlobalErrorBubbleView( |
| 40 views::View* anchor_view, | 40 views::View* anchor_view, |
| 41 views::BubbleBorder::ArrowLocation location, | 41 views::BubbleBorder::ArrowLocation location, |
| 42 const SkColor& color, | |
| 43 Browser* browser, | 42 Browser* browser, |
| 44 GlobalError* error) | 43 GlobalError* error) |
| 45 : BubbleDelegateView(anchor_view, location, color), | 44 : BubbleDelegateView(anchor_view, location), |
| 46 browser_(browser), | 45 browser_(browser), |
| 47 error_(error) { | 46 error_(error) { |
| 48 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 47 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 49 int resource_id = error_->GetBubbleViewIconResourceID(); | 48 int resource_id = error_->GetBubbleViewIconResourceID(); |
| 50 scoped_ptr<views::ImageView> image_view(new views::ImageView()); | 49 scoped_ptr<views::ImageView> image_view(new views::ImageView()); |
| 51 image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap()); | 50 image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap()); |
| 52 | 51 |
| 53 string16 title_string(error_->GetBubbleViewTitle()); | 52 string16 title_string(error_->GetBubbleViewTitle()); |
| 54 scoped_ptr<views::Label> title_label(new views::Label(title_string)); | 53 scoped_ptr<views::Label> title_label(new views::Label(title_string)); |
| 55 title_label->SetMultiLine(true); | 54 title_label->SetMultiLine(true); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void GlobalErrorBubbleView::WindowClosing() { | 142 void GlobalErrorBubbleView::WindowClosing() { |
| 144 error_->BubbleViewDidClose(); | 143 error_->BubbleViewDidClose(); |
| 145 } | 144 } |
| 146 | 145 |
| 147 void GlobalError::ShowBubbleView(Browser* browser, GlobalError* error) { | 146 void GlobalError::ShowBubbleView(Browser* browser, GlobalError* error) { |
| 148 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 147 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 149 views::View* wrench_button = browser_view->toolbar()->app_menu(); | 148 views::View* wrench_button = browser_view->toolbar()->app_menu(); |
| 150 GlobalErrorBubbleView* bubble_view = | 149 GlobalErrorBubbleView* bubble_view = |
| 151 new GlobalErrorBubbleView(wrench_button, | 150 new GlobalErrorBubbleView(wrench_button, |
| 152 views::BubbleBorder::TOP_RIGHT, | 151 views::BubbleBorder::TOP_RIGHT, |
| 153 SK_ColorWHITE, | |
| 154 browser, | 152 browser, |
| 155 error); | 153 error); |
| 156 browser::CreateViewsBubble(bubble_view); | 154 browser::CreateViewsBubble(bubble_view); |
| 157 bubble_view->StartFade(true); | 155 bubble_view->StartFade(true); |
| 158 } | 156 } |
| OLD | NEW |