| 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" |
| 11 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 11 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 12 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 void PerformClose(OneClickSigninBubbleController* controller) { | 16 void PerformClose(OneClickSigninBubbleController* controller) { |
| 16 [controller close]; | 17 [controller close]; |
| 17 } | 18 } |
| 18 | 19 |
| 19 } // namespace | 20 } // namespace |
| 20 | 21 |
| 21 @implementation OneClickSigninBubbleController | 22 @implementation OneClickSigninBubbleController |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 email:base::string16() | 35 email:base::string16() |
| 35 errorMessage:errorMessage]); | 36 errorMessage:errorMessage]); |
| 36 | 37 |
| 37 NSWindow* parentWindow = [controller window]; | 38 NSWindow* parentWindow = [controller window]; |
| 38 | 39 |
| 39 // Set the anchor point to right below the app menu. | 40 // Set the anchor point to right below the app menu. |
| 40 NSView* appMenuButton = [[controller toolbarController] appMenuButton]; | 41 NSView* appMenuButton = [[controller toolbarController] appMenuButton]; |
| 41 const NSRect bounds = [appMenuButton bounds]; | 42 const NSRect bounds = [appMenuButton bounds]; |
| 42 NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds)); | 43 NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds)); |
| 43 anchorPoint = [appMenuButton convertPoint:anchorPoint toView:nil]; | 44 anchorPoint = [appMenuButton convertPoint:anchorPoint toView:nil]; |
| 44 anchorPoint = [parentWindow convertBaseToScreen:anchorPoint]; | 45 anchorPoint = ui::ConvertPointFromWindowToScreen(parentWindow, anchorPoint); |
| 45 | 46 |
| 46 // Create an empty window into which content is placed. | 47 // Create an empty window into which content is placed. |
| 47 NSRect viewBounds = [[viewController_ view] bounds]; | 48 NSRect viewBounds = [[viewController_ view] bounds]; |
| 48 base::scoped_nsobject<InfoBubbleWindow> window( | 49 base::scoped_nsobject<InfoBubbleWindow> window( |
| 49 [[InfoBubbleWindow alloc] initWithContentRect:viewBounds | 50 [[InfoBubbleWindow alloc] initWithContentRect:viewBounds |
| 50 styleMask:NSBorderlessWindowMask | 51 styleMask:NSBorderlessWindowMask |
| 51 backing:NSBackingStoreBuffered | 52 backing:NSBackingStoreBuffered |
| 52 defer:NO]); | 53 defer:NO]); |
| 53 if (self = [super initWithWindow:window | 54 if (self = [super initWithWindow:window |
| 54 parentWindow:parentWindow | 55 parentWindow:parentWindow |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 - (OneClickSigninViewController*)viewController { | 66 - (OneClickSigninViewController*)viewController { |
| 66 return viewController_; | 67 return viewController_; |
| 67 } | 68 } |
| 68 | 69 |
| 69 - (void)windowWillClose:(NSNotification*)notification { | 70 - (void)windowWillClose:(NSNotification*)notification { |
| 70 [viewController_ viewWillClose]; | 71 [viewController_ viewWillClose]; |
| 71 [super windowWillClose:notification]; | 72 [super windowWillClose:notification]; |
| 72 } | 73 } |
| 73 | 74 |
| 74 @end // OneClickSigninBubbleController | 75 @end // OneClickSigninBubbleController |
| OLD | NEW |