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/base_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 - (id)initWithWindowNibPath:(NSString*)nibPath | 34 - (id)initWithWindowNibPath:(NSString*)nibPath |
35 parentWindow:(NSWindow*)parentWindow | 35 parentWindow:(NSWindow*)parentWindow |
36 anchoredAt:(NSPoint)anchoredAt { | 36 anchoredAt:(NSPoint)anchoredAt { |
37 nibPath = [base::mac::FrameworkBundle() pathForResource:nibPath | 37 nibPath = [base::mac::FrameworkBundle() pathForResource:nibPath |
38 ofType:@"nib"]; | 38 ofType:@"nib"]; |
39 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { | 39 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { |
40 parentWindow_ = parentWindow; | 40 parentWindow_ = parentWindow; |
41 anchor_ = anchoredAt; | 41 anchor_ = anchoredAt; |
42 shouldOpenAsKeyWindow_ = YES; | 42 shouldOpenAsKeyWindow_ = YES; |
| 43 shouldCloseOnResignKey_ = YES; |
43 | 44 |
44 // Watch to see if the parent window closes, and if so, close this one. | 45 // Watch to see if the parent window closes, and if so, close this one. |
45 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 46 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
46 [center addObserver:self | 47 [center addObserver:self |
47 selector:@selector(parentWindowWillClose:) | 48 selector:@selector(parentWindowWillClose:) |
48 name:NSWindowWillCloseNotification | 49 name:NSWindowWillCloseNotification |
49 object:parentWindow_]; | 50 object:parentWindow_]; |
50 } | 51 } |
51 return self; | 52 return self; |
52 } | 53 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 287 |
287 - (void)activateTabWithContents:(content::WebContents*)newContents | 288 - (void)activateTabWithContents:(content::WebContents*)newContents |
288 previousContents:(content::WebContents*)oldContents | 289 previousContents:(content::WebContents*)oldContents |
289 atIndex:(NSInteger)index | 290 atIndex:(NSInteger)index |
290 reason:(int)reason { | 291 reason:(int)reason { |
291 // The user switched tabs; close. | 292 // The user switched tabs; close. |
292 [self close]; | 293 [self close]; |
293 } | 294 } |
294 | 295 |
295 @end // BaseBubbleController | 296 @end // BaseBubbleController |
OLD | NEW |