OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 12 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
14 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
15 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
16 #include "chrome/common/notification_type.h" | 16 #include "chrome/common/notification_type.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 | 18 |
19 @interface BaseBubbleController (Private) | 19 @interface BaseBubbleController (Private) |
(...skipping 27 matching lines...) Expand all Loading... |
47 | 47 |
48 @implementation BaseBubbleController | 48 @implementation BaseBubbleController |
49 | 49 |
50 @synthesize parentWindow = parentWindow_; | 50 @synthesize parentWindow = parentWindow_; |
51 @synthesize anchorPoint = anchor_; | 51 @synthesize anchorPoint = anchor_; |
52 @synthesize bubble = bubble_; | 52 @synthesize bubble = bubble_; |
53 | 53 |
54 - (id)initWithWindowNibPath:(NSString*)nibPath | 54 - (id)initWithWindowNibPath:(NSString*)nibPath |
55 parentWindow:(NSWindow*)parentWindow | 55 parentWindow:(NSWindow*)parentWindow |
56 anchoredAt:(NSPoint)anchoredAt { | 56 anchoredAt:(NSPoint)anchoredAt { |
57 nibPath = [mac_util::MainAppBundle() pathForResource:nibPath | 57 nibPath = [base::mac::MainAppBundle() pathForResource:nibPath |
58 ofType:@"nib"]; | 58 ofType:@"nib"]; |
59 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { | 59 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { |
60 parentWindow_ = parentWindow; | 60 parentWindow_ = parentWindow; |
61 anchor_ = anchoredAt; | 61 anchor_ = anchoredAt; |
62 | 62 |
63 // Watch to see if the parent window closes, and if so, close this one. | 63 // Watch to see if the parent window closes, and if so, close this one. |
64 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 64 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
65 [center addObserver:self | 65 [center addObserver:self |
66 selector:@selector(parentWindowWillClose:) | 66 selector:@selector(parentWindowWillClose:) |
67 name:NSWindowWillCloseNotification | 67 name:NSWindowWillCloseNotification |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { | 191 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { |
192 origin.x -= NSWidth([window frame]) - offsets.width; | 192 origin.x -= NSWidth([window frame]) - offsets.width; |
193 } else { | 193 } else { |
194 origin.x -= offsets.width; | 194 origin.x -= offsets.width; |
195 } | 195 } |
196 origin.y -= NSHeight([window frame]); | 196 origin.y -= NSHeight([window frame]); |
197 [window setFrameOrigin:origin]; | 197 [window setFrameOrigin:origin]; |
198 } | 198 } |
199 | 199 |
200 @end // BaseBubbleController | 200 @end // BaseBubbleController |
OLD | NEW |