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

Side by Side Diff: chrome/browser/profiles/avatar_menu.cc

Issue 1128173005: Clean up ProfileManager interface. Base URL: https://chromium.googlesource.com/chromium/src@issue479309
Patch Set: sync Created 5 years, 6 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 (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 #include "chrome/browser/profiles/avatar_menu.h" 5 #include "chrome/browser/profiles/avatar_menu.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 size_t AvatarMenu::GetActiveProfileIndex() { 182 size_t AvatarMenu::GetActiveProfileIndex() {
183 183
184 // During singleton profile deletion, this function can be called with no 184 // During singleton profile deletion, this function can be called with no
185 // profiles in the model - crbug.com/102278 . 185 // profiles in the model - crbug.com/102278 .
186 if (profile_list_->GetNumberOfItems() == 0) 186 if (profile_list_->GetNumberOfItems() == 0)
187 return 0; 187 return 0;
188 188
189 Profile* active_profile = NULL; 189 Profile* active_profile = NULL;
190 if (!browser_) 190 if (!browser_)
191 active_profile = ProfileManager::GetLastUsedProfile(); 191 active_profile = g_browser_process->profile_manager()->GetLastUsedProfile();
192 else 192 else
193 active_profile = browser_->profile(); 193 active_profile = browser_->profile();
194 194
195 size_t index = 195 size_t index =
196 profile_info_->GetIndexOfProfileWithPath(active_profile->GetPath()); 196 profile_info_->GetIndexOfProfileWithPath(active_profile->GetPath());
197 197
198 index = profile_list_->MenuIndexFromProfileIndex(index); 198 index = profile_list_->MenuIndexFromProfileIndex(index);
199 DCHECK_LT(index, profile_list_->GetNumberOfItems()); 199 DCHECK_LT(index, profile_list_->GetNumberOfItems());
200 return index; 200 return index;
201 } 201 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (observer_) 299 if (observer_)
300 observer_->OnAvatarMenuChanged(this); 300 observer_->OnAvatarMenuChanged(this);
301 } 301 }
302 #endif 302 #endif
303 303
304 void AvatarMenu::Update() { 304 void AvatarMenu::Update() {
305 RebuildMenu(); 305 RebuildMenu();
306 if (observer_) 306 if (observer_)
307 observer_->OnAvatarMenuChanged(this); 307 observer_->OnAvatarMenuChanged(this);
308 } 308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698