| 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/logging.h" | 7 #include "base/logging.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool GlobalErrorBubbleView::FadeInOnShow() { | 141 bool GlobalErrorBubbleView::FadeInOnShow() { |
| 142 // TODO(sail): Enabling fade causes the window to be disabled for some | 142 // TODO(sail): Enabling fade causes the window to be disabled for some |
| 143 // reason. Until this is fixed we need to disable fade. | 143 // reason. Until this is fixed we need to disable fade. |
| 144 return false; | 144 return false; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void GlobalError::ShowBubbleView(Browser* browser, GlobalError* error) { | 147 void GlobalError::ShowBubbleView(Browser* browser, GlobalError* error) { |
| 148 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 148 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 149 browser->window()->GetNativeHandle()); | |
| 150 views::View* wrench_button = browser_view->toolbar()->app_menu(); | 149 views::View* wrench_button = browser_view->toolbar()->app_menu(); |
| 151 | 150 |
| 152 gfx::Point origin; | 151 gfx::Point origin; |
| 153 views::View::ConvertPointToScreen(wrench_button, &origin); | 152 views::View::ConvertPointToScreen(wrench_button, &origin); |
| 154 gfx::Rect bounds(origin.x(), origin.y(), wrench_button->width(), | 153 gfx::Rect bounds(origin.x(), origin.y(), wrench_button->width(), |
| 155 wrench_button->height()); | 154 wrench_button->height()); |
| 156 bounds.Inset(0, kWrenchBubblePointOffsetY); | 155 bounds.Inset(0, kWrenchBubblePointOffsetY); |
| 157 | 156 |
| 158 GlobalErrorBubbleView* bubble_view = | 157 GlobalErrorBubbleView* bubble_view = |
| 159 new GlobalErrorBubbleView(browser, error); | 158 new GlobalErrorBubbleView(browser, error); |
| 160 // Bubble::Show() takes ownership of the view. | 159 // Bubble::Show() takes ownership of the view. |
| 161 Bubble::Show(browser_view->GetWidget(), bounds, | 160 Bubble::Show(browser_view->GetWidget(), bounds, |
| 162 views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view); | 161 views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view); |
| 163 } | 162 } |
| OLD | NEW |