OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |