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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm

Issue 1221173003: [Mac] Inform reference counted objects that hold a weak Browser* when the Browser is being destroye… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/profiles/avatar_base_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 - (id)initWithBrowser:(Browser*)browser { 124 - (id)initWithBrowser:(Browser*)browser {
125 if ((self = [super init])) { 125 if ((self = [super init])) {
126 browser_ = browser; 126 browser_ = browser;
127 profileInfoObserver_.reset( 127 profileInfoObserver_.reset(
128 new ProfileInfoUpdateObserver(browser_->profile(), self)); 128 new ProfileInfoUpdateObserver(browser_->profile(), self));
129 } 129 }
130 return self; 130 return self;
131 } 131 }
132 132
133 - (void)dealloc { 133 - (void)dealloc {
134 [self browserWillBeDestroyed];
135 [super dealloc];
136 }
137
138 - (void)browserWillBeDestroyed {
134 [[NSNotificationCenter defaultCenter] 139 [[NSNotificationCenter defaultCenter]
135 removeObserver:self 140 removeObserver:self
136 name:NSWindowWillCloseNotification 141 name:NSWindowWillCloseNotification
137 object:[menuController_ window]]; 142 object:[menuController_ window]];
138 [super dealloc]; 143 browser_ = nullptr;
139 } 144 }
140 145
141 - (NSButton*)buttonView { 146 - (NSButton*)buttonView {
142 CHECK(button_.get()); // Subclasses must set this. 147 CHECK(button_.get()); // Subclasses must set this.
143 return button_.get(); 148 return button_.get();
144 } 149 }
145 150
146 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor 151 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor
147 withMode:(BrowserWindow::AvatarBubbleMode)mode 152 withMode:(BrowserWindow::AvatarBubbleMode)mode
148 withServiceType:(signin::GAIAServiceType)serviceType { 153 withServiceType:(signin::GAIAServiceType)serviceType {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 260 }
256 261
257 - (void)updateErrorStatus:(BOOL)hasError { 262 - (void)updateErrorStatus:(BOOL)hasError {
258 } 263 }
259 264
260 - (BaseBubbleController*)menuController { 265 - (BaseBubbleController*)menuController {
261 return menuController_; 266 return menuController_;
262 } 267 }
263 268
264 @end 269 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698