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

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

Issue 530113002: Refresh the avatar bubble with the current view (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only refresh if necessary 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/views/profiles/profile_chooser_view.cc » ('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 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE { 304 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE {
305 // Tokens can only be removed from the account management view. Refresh it 305 // Tokens can only be removed from the account management view. Refresh it
306 // to show the update. 306 // to show the update.
307 if ([controller_ viewMode] == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) 307 if ([controller_ viewMode] == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT)
308 [controller_ initMenuContentsWithView: 308 [controller_ initMenuContentsWithView:
309 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; 309 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT];
310 } 310 }
311 311
312 // AvatarMenuObserver: 312 // AvatarMenuObserver:
313 virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE { 313 virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE {
314 // Do not refresh the avatar menu if the user is on a signin related view.
315 profiles::BubbleViewMode viewMode = [controller_ viewMode]; 314 profiles::BubbleViewMode viewMode = [controller_ viewMode];
316 if (viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || 315 if (viewMode == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ||
317 viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || 316 viewMode == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) {
318 viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { 317 [controller_ initMenuContentsWithView:viewMode];
319 return;
320 } 318 }
321
322 // While the bubble is open, the avatar menu can only change from the
323 // profile chooser view by modifying the current profile's photo or name.
324 [controller_
325 initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER];
326 } 319 }
327 320
328 // content::NotificationObserver: 321 // content::NotificationObserver:
329 virtual void Observe( 322 virtual void Observe(
330 int type, 323 int type,
331 const content::NotificationSource& source, 324 const content::NotificationSource& source,
332 const content::NotificationDetails& details) OVERRIDE { 325 const content::NotificationDetails& details) OVERRIDE {
333 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_CLOSING, type); 326 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_CLOSING, type);
334 if (browser_ == content::Source<Browser>(source).ptr()) { 327 if (browser_ == content::Source<Browser>(source).ptr()) {
335 RemoveTokenServiceObserver(); 328 RemoveTokenServiceObserver();
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 } 2154 }
2162 2155
2163 - (bool)shouldShowGoIncognito { 2156 - (bool)shouldShowGoIncognito {
2164 bool incognitoAvailable = 2157 bool incognitoAvailable =
2165 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2158 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2166 IncognitoModePrefs::DISABLED; 2159 IncognitoModePrefs::DISABLED;
2167 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2160 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2168 } 2161 }
2169 2162
2170 @end 2163 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698