| 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 #import "chrome/browser/ui/cocoa/global_error_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/global_error_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/search_engines/util.h" | 10 #include "chrome/browser/search_engines/util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 GlobalErrorBubbleController* controller_; // Weak, owns this. | 47 GlobalErrorBubbleController* controller_; // Weak, owns this. |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace GlobalErrorBubbleControllerInternal | 50 } // namespace GlobalErrorBubbleControllerInternal |
| 51 | 51 |
| 52 @implementation GlobalErrorBubbleController | 52 @implementation GlobalErrorBubbleController |
| 53 | 53 |
| 54 + (GlobalErrorBubbleViewBase*)showForBrowser:(Browser*)browser | 54 + (GlobalErrorBubbleViewBase*)showForBrowser:(Browser*)browser |
| 55 error:(const base::WeakPtr<GlobalError>&)error { | 55 error:(const base::WeakPtr<GlobalError>&)error { |
| 56 NSWindow* parentWindow = browser->window()->GetNativeHandle(); | 56 NSWindow* parentWindow = browser->window()->GetNativeWindow(); |
| 57 BrowserWindowController* bwc = [BrowserWindowController | 57 BrowserWindowController* bwc = [BrowserWindowController |
| 58 browserWindowControllerForWindow:parentWindow]; | 58 browserWindowControllerForWindow:parentWindow]; |
| 59 NSView* wrenchButton = [[bwc toolbarController] wrenchButton]; | 59 NSView* wrenchButton = [[bwc toolbarController] wrenchButton]; |
| 60 NSPoint offset = NSMakePoint(NSMidX([wrenchButton bounds]), | 60 NSPoint offset = NSMakePoint(NSMidX([wrenchButton bounds]), |
| 61 kWrenchBubblePointOffsetY); | 61 kWrenchBubblePointOffsetY); |
| 62 | 62 |
| 63 // The bubble will be automatically deleted when the window is closed. | 63 // The bubble will be automatically deleted when the window is closed. |
| 64 GlobalErrorBubbleController* bubble = [[GlobalErrorBubbleController alloc] | 64 GlobalErrorBubbleController* bubble = [[GlobalErrorBubbleController alloc] |
| 65 initWithWindowNibPath:@"GlobalErrorBubble" | 65 initWithWindowNibPath:@"GlobalErrorBubble" |
| 66 relativeToView:wrenchButton | 66 relativeToView:wrenchButton |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 [self close]; | 142 [self close]; |
| 143 } | 143 } |
| 144 | 144 |
| 145 @end | 145 @end |
| 146 | 146 |
| 147 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowBubbleView( | 147 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowBubbleView( |
| 148 Browser* browser, | 148 Browser* browser, |
| 149 const base::WeakPtr<GlobalError>& error) { | 149 const base::WeakPtr<GlobalError>& error) { |
| 150 return [GlobalErrorBubbleController showForBrowser:browser error:error]; | 150 return [GlobalErrorBubbleController showForBrowser:browser error:error]; |
| 151 } | 151 } |
| OLD | NEW |