Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/browser/ui/cocoa/base_bubble_controller.mm

Issue 573143002: Mac: Give bubble windows an initial position before showing them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: setAnchorPoint Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698