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 18 matching lines...) Expand all Loading... |
29 initWithNibName:@"OneClickSigninBubble" | 29 initWithNibName:@"OneClickSigninBubble" |
30 webContents:webContents | 30 webContents:webContents |
31 syncCallback:syncCallback | 31 syncCallback:syncCallback |
32 closeCallback:base::Bind(PerformClose, self) | 32 closeCallback:base::Bind(PerformClose, self) |
33 isSyncDialog:NO | 33 isSyncDialog:NO |
34 email:base::string16() | 34 email:base::string16() |
35 errorMessage:errorMessage]); | 35 errorMessage:errorMessage]); |
36 | 36 |
37 NSWindow* parentWindow = [controller window]; | 37 NSWindow* parentWindow = [controller window]; |
38 | 38 |
39 // Set the anchor point to right below the wrench menu. | 39 // Set the anchor point to right below the app menu. |
40 NSView* wrenchButton = [[controller toolbarController] wrenchButton]; | 40 NSView* appMenuButton = [[controller toolbarController] appMenuButton]; |
41 const NSRect bounds = [wrenchButton bounds]; | 41 const NSRect bounds = [appMenuButton bounds]; |
42 NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds)); | 42 NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds)); |
43 anchorPoint = [wrenchButton convertPoint:anchorPoint toView:nil]; | 43 anchorPoint = [appMenuButton convertPoint:anchorPoint toView:nil]; |
44 anchorPoint = [parentWindow convertBaseToScreen:anchorPoint]; | 44 anchorPoint = [parentWindow convertBaseToScreen:anchorPoint]; |
45 | 45 |
46 // Create an empty window into which content is placed. | 46 // Create an empty window into which content is placed. |
47 NSRect viewBounds = [[viewController_ view] bounds]; | 47 NSRect viewBounds = [[viewController_ view] bounds]; |
48 base::scoped_nsobject<InfoBubbleWindow> window( | 48 base::scoped_nsobject<InfoBubbleWindow> window( |
49 [[InfoBubbleWindow alloc] initWithContentRect:viewBounds | 49 [[InfoBubbleWindow alloc] initWithContentRect:viewBounds |
50 styleMask:NSBorderlessWindowMask | 50 styleMask:NSBorderlessWindowMask |
51 backing:NSBackingStoreBuffered | 51 backing:NSBackingStoreBuffered |
52 defer:NO]); | 52 defer:NO]); |
53 if (self = [super initWithWindow:window | 53 if (self = [super initWithWindow:window |
(...skipping 11 matching lines...) Expand all Loading... |
65 - (OneClickSigninViewController*)viewController { | 65 - (OneClickSigninViewController*)viewController { |
66 return viewController_; | 66 return viewController_; |
67 } | 67 } |
68 | 68 |
69 - (void)windowWillClose:(NSNotification*)notification { | 69 - (void)windowWillClose:(NSNotification*)notification { |
70 [viewController_ viewWillClose]; | 70 [viewController_ viewWillClose]; |
71 [super windowWillClose:notification]; | 71 [super windowWillClose:notification]; |
72 } | 72 } |
73 | 73 |
74 @end // OneClickSigninBubbleController | 74 @end // OneClickSigninBubbleController |
OLD | NEW |