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/one_click_signin_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
10 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h" | 10 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Set the anchor point to right below the wrench menu. | 38 // Set the anchor point to right below the wrench menu. |
39 NSView* wrenchButton = [[controller toolbarController] wrenchButton]; | 39 NSView* wrenchButton = [[controller toolbarController] wrenchButton]; |
40 const NSRect bounds = [wrenchButton bounds]; | 40 const NSRect bounds = [wrenchButton bounds]; |
41 NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds)); | 41 NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds)); |
42 anchorPoint = [wrenchButton convertPoint:anchorPoint toView:nil]; | 42 anchorPoint = [wrenchButton convertPoint:anchorPoint toView:nil]; |
43 anchorPoint = [parentWindow convertBaseToScreen:anchorPoint]; | 43 anchorPoint = [parentWindow convertBaseToScreen:anchorPoint]; |
44 | 44 |
45 // Create an empty window into which content is placed. | 45 // Create an empty window into which content is placed. |
46 NSRect viewBounds = [[viewController_ view] bounds]; | 46 NSRect viewBounds = [[viewController_ view] bounds]; |
47 scoped_nsobject<InfoBubbleWindow> window( | 47 base::scoped_nsobject<InfoBubbleWindow> window( |
48 [[InfoBubbleWindow alloc] initWithContentRect:viewBounds | 48 [[InfoBubbleWindow alloc] initWithContentRect:viewBounds |
49 styleMask:NSBorderlessWindowMask | 49 styleMask:NSBorderlessWindowMask |
50 backing:NSBackingStoreBuffered | 50 backing:NSBackingStoreBuffered |
51 defer:NO]); | 51 defer:NO]); |
52 if (self = [super initWithWindow:window | 52 if (self = [super initWithWindow:window |
53 parentWindow:parentWindow | 53 parentWindow:parentWindow |
54 anchoredAt:anchorPoint]) { | 54 anchoredAt:anchorPoint]) { |
55 [[window contentView] addSubview:[viewController_ view]]; | 55 [[window contentView] addSubview:[viewController_ view]]; |
56 // This class will release itself when the bubble closes. See | 56 // This class will release itself when the bubble closes. See |
57 // -[BaseBubbleController windowWillClose:]. | 57 // -[BaseBubbleController windowWillClose:]. |
58 [self retain]; | 58 [self retain]; |
59 } | 59 } |
60 | 60 |
61 return self; | 61 return self; |
62 } | 62 } |
63 | 63 |
64 - (OneClickSigninViewController*)viewController { | 64 - (OneClickSigninViewController*)viewController { |
65 return viewController_; | 65 return viewController_; |
66 } | 66 } |
67 | 67 |
68 - (void)windowWillClose:(NSNotification*)notification { | 68 - (void)windowWillClose:(NSNotification*)notification { |
69 [viewController_ viewWillClose]; | 69 [viewController_ viewWillClose]; |
70 [super windowWillClose:notification]; | 70 [super windowWillClose:notification]; |
71 } | 71 } |
72 | 72 |
73 @end // OneClickSigninBubbleController | 73 @end // OneClickSigninBubbleController |
OLD | NEW |