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

Unified Diff: chrome/browser/profiles/avatar_menu_model.cc

Issue 9500003: Add a button to exit managed mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/avatar_menu_model.cc
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index fb943ee6f65110dbd408f4e877be66bc4cfba430..11c007645c137ba6ff444998d5a484eaa5afbdad 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -51,7 +51,6 @@ AvatarMenuModel::AvatarMenuModel(ProfileInfoInterface* profile_cache,
observer_(observer),
browser_(browser) {
DCHECK(profile_info_);
- DCHECK(observer_);
// Don't DCHECK(browser_) so that unit tests can reuse this ctor.
// Register this as an observer of the info cache.
@@ -76,6 +75,8 @@ AvatarMenuModel::Item::~Item() {
}
void AvatarMenuModel::SwitchToProfile(size_t index, bool always_create) {
+ DCHECK(ProfileManager::IsMultipleProfilesEnabled() ||
+ index == GetActiveProfileIndex());
const Item& item = GetItemAt(index);
FilePath path = profile_info_->GetPathOfProfileAtIndex(item.model_index);
g_browser_process->profile_manager()->CreateProfileAsync(
@@ -135,7 +136,8 @@ void AvatarMenuModel::Observe(int type,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, type);
RebuildMenu();
- observer_->OnAvatarMenuModelChanged(this);
+ if (observer_)
+ observer_->OnAvatarMenuModelChanged(this);
}
// static

Powered by Google App Engine
This is Rietveld 408576698