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

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

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 5 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 | Annotate | Revision Log
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/memory/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
13 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 13 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 17
18 @interface BaseBubbleController (Private) 18 @interface BaseBubbleController (Private)
19 - (void)updateOriginFromAnchor; 19 - (void)updateOriginFromAnchor;
20 - (void)activateTabWithContents:(content::WebContents*)newContents 20 - (void)activateTabWithContents:(content::WebContents*)newContents
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 anchoredAt:(NSPoint)anchoredAt { 69 anchoredAt:(NSPoint)anchoredAt {
70 DCHECK(theWindow); 70 DCHECK(theWindow);
71 if ((self = [super initWithWindow:theWindow])) { 71 if ((self = [super initWithWindow:theWindow])) {
72 parentWindow_ = parentWindow; 72 parentWindow_ = parentWindow;
73 anchor_ = anchoredAt; 73 anchor_ = anchoredAt;
74 shouldOpenAsKeyWindow_ = YES; 74 shouldOpenAsKeyWindow_ = YES;
75 75
76 DCHECK(![[self window] delegate]); 76 DCHECK(![[self window] delegate]);
77 [theWindow setDelegate:self]; 77 [theWindow setDelegate:self];
78 78
79 scoped_nsobject<InfoBubbleView> contentView( 79 base::scoped_nsobject<InfoBubbleView> contentView(
80 [[InfoBubbleView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)]); 80 [[InfoBubbleView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)]);
81 [theWindow setContentView:contentView.get()]; 81 [theWindow setContentView:contentView.get()];
82 bubble_ = contentView.get(); 82 bubble_ = contentView.get();
83 83
84 // Watch to see if the parent window closes, and if so, close this one. 84 // Watch to see if the parent window closes, and if so, close this one.
85 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 85 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
86 [center addObserver:self 86 [center addObserver:self
87 selector:@selector(parentWindowWillClose:) 87 selector:@selector(parentWindowWillClose:)
88 name:NSWindowWillCloseNotification 88 name:NSWindowWillCloseNotification
89 object:parentWindow_]; 89 object:parentWindow_];
(...skipping 26 matching lines...) Expand all
116 [super dealloc]; 116 [super dealloc];
117 } 117 }
118 118
119 - (void)setAnchorPoint:(NSPoint)anchor { 119 - (void)setAnchorPoint:(NSPoint)anchor {
120 anchor_ = anchor; 120 anchor_ = anchor;
121 [self updateOriginFromAnchor]; 121 [self updateOriginFromAnchor];
122 } 122 }
123 123
124 - (NSBox*)separatorWithFrame:(NSRect)frame { 124 - (NSBox*)separatorWithFrame:(NSRect)frame {
125 frame.size.height = 1.0; 125 frame.size.height = 1.0;
126 scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]); 126 base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]);
127 [spacer setBoxType:NSBoxSeparator]; 127 [spacer setBoxType:NSBoxSeparator];
128 [spacer setBorderType:NSLineBorder]; 128 [spacer setBorderType:NSLineBorder];
129 [spacer setAlphaValue:0.2]; 129 [spacer setAlphaValue:0.2];
130 return [spacer.release() autorelease]; 130 return [spacer.release() autorelease];
131 } 131 }
132 132
133 - (void)parentWindowWillClose:(NSNotification*)notification { 133 - (void)parentWindowWillClose:(NSNotification*)notification {
134 parentWindow_ = nil; 134 parentWindow_ = nil;
135 [self close]; 135 [self close];
136 } 136 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 - (void)activateTabWithContents:(content::WebContents*)newContents 285 - (void)activateTabWithContents:(content::WebContents*)newContents
286 previousContents:(content::WebContents*)oldContents 286 previousContents:(content::WebContents*)oldContents
287 atIndex:(NSInteger)index 287 atIndex:(NSInteger)index
288 reason:(int)reason { 288 reason:(int)reason {
289 // The user switched tabs; close. 289 // The user switched tabs; close.
290 [self close]; 290 [self close];
291 } 291 }
292 292
293 @end // BaseBubbleController 293 @end // BaseBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698