| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 parentWindow:window | 65 parentWindow:window |
| 66 anchoredAt:anchor]; | 66 anchoredAt:anchor]; |
| 67 } | 67 } |
| 68 | 68 |
| 69 - (id)initWithWindow:(NSWindow*)theWindow | 69 - (id)initWithWindow:(NSWindow*)theWindow |
| 70 parentWindow:(NSWindow*)parentWindow | 70 parentWindow:(NSWindow*)parentWindow |
| 71 anchoredAt:(NSPoint)anchoredAt { | 71 anchoredAt:(NSPoint)anchoredAt { |
| 72 DCHECK(theWindow); | 72 DCHECK(theWindow); |
| 73 if ((self = [super initWithWindow:theWindow])) { | 73 if ((self = [super initWithWindow:theWindow])) { |
| 74 parentWindow_ = parentWindow; | 74 parentWindow_ = parentWindow; |
| 75 anchor_ = anchoredAt; | |
| 76 shouldOpenAsKeyWindow_ = YES; | 75 shouldOpenAsKeyWindow_ = YES; |
| 77 shouldCloseOnResignKey_ = YES; | 76 shouldCloseOnResignKey_ = YES; |
| 78 | 77 |
| 79 DCHECK(![[self window] delegate]); | 78 DCHECK(![[self window] delegate]); |
| 80 [theWindow setDelegate:self]; | 79 [theWindow setDelegate:self]; |
| 81 | 80 |
| 82 base::scoped_nsobject<InfoBubbleView> contentView( | 81 base::scoped_nsobject<InfoBubbleView> contentView( |
| 83 [[InfoBubbleView alloc] initWithFrame:NSZeroRect]); | 82 [[InfoBubbleView alloc] initWithFrame:NSZeroRect]); |
| 84 [theWindow setContentView:contentView.get()]; | 83 [theWindow setContentView:contentView.get()]; |
| 85 bubble_ = contentView.get(); | 84 bubble_ = contentView.get(); |
| 86 | 85 |
| 87 [self registerForNotifications]; | 86 [self registerForNotifications]; |
| 88 [self awakeFromNib]; | 87 [self awakeFromNib]; |
| 88 [self setAnchorPoint:anchoredAt]; |
| 89 } | 89 } |
| 90 return self; | 90 return self; |
| 91 } | 91 } |
| 92 | 92 |
| 93 - (void)awakeFromNib { | 93 - (void)awakeFromNib { |
| 94 // Check all connections have been made in Interface Builder. | 94 // Check all connections have been made in Interface Builder. |
| 95 DCHECK([self window]); | 95 DCHECK([self window]); |
| 96 DCHECK(bubble_); | 96 DCHECK(bubble_); |
| 97 DCHECK_EQ(self, [[self window] delegate]); | 97 DCHECK_EQ(self, [[self window] delegate]); |
| 98 | 98 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 380 |
| 381 - (void)activateTabWithContents:(content::WebContents*)newContents | 381 - (void)activateTabWithContents:(content::WebContents*)newContents |
| 382 previousContents:(content::WebContents*)oldContents | 382 previousContents:(content::WebContents*)oldContents |
| 383 atIndex:(NSInteger)index | 383 atIndex:(NSInteger)index |
| 384 reason:(int)reason { | 384 reason:(int)reason { |
| 385 // The user switched tabs; close. | 385 // The user switched tabs; close. |
| 386 [self close]; | 386 [self close]; |
| 387 } | 387 } |
| 388 | 388 |
| 389 @end // BaseBubbleController | 389 @end // BaseBubbleController |
| OLD | NEW |