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

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

Issue 23532073: Only showing the new multi user menus when there are at least 2 suitable users known to the system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/ash/chrome_shell_delegate.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 (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_model.h" 5 #include "chrome/browser/profiles/avatar_menu_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/profiles/avatar_menu_model_observer.h" 15 #include "chrome/browser/profiles/avatar_menu_model_observer.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_info_cache.h" 17 #include "chrome/browser/profiles/profile_info_cache.h"
18 #include "chrome/browser/profiles/profile_info_util.h" 18 #include "chrome/browser/profiles/profile_info_util.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/profiles/profile_metrics.h" 20 #include "chrome/browser/profiles/profile_metrics.h"
21 #include "chrome/browser/profiles/profile_window.h" 21 #include "chrome/browser/profiles/profile_window.h"
22 #include "chrome/browser/profiles/profiles_state.h" 22 #include "chrome/browser/profiles/profiles_state.h"
23 #include "chrome/browser/signin/signin_promo.h" 23 #include "chrome/browser/signin/signin_promo.h"
24 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
24 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
27 #include "chrome/browser/ui/chrome_pages.h" 28 #include "chrome/browser/ui/chrome_pages.h"
28 #include "chrome/browser/ui/host_desktop.h" 29 #include "chrome/browser/ui/host_desktop.h"
29 #include "chrome/browser/ui/startup/startup_browser_creator.h" 30 #include "chrome/browser/ui/startup/startup_browser_creator.h"
30 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
32 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // static 263 // static
263 bool AvatarMenuModel::ShouldShowAvatarMenu() { 264 bool AvatarMenuModel::ShouldShowAvatarMenu() {
264 if (base::FieldTrialList::FindFullName(kShowProfileSwitcherFieldTrialName) == 265 if (base::FieldTrialList::FindFullName(kShowProfileSwitcherFieldTrialName) ==
265 kAlwaysShowSwitcherGroupName) { 266 kAlwaysShowSwitcherGroupName) {
266 // We should only be in this group when multi-profiles is enabled. 267 // We should only be in this group when multi-profiles is enabled.
267 DCHECK(profiles::IsMultipleProfilesEnabled()); 268 DCHECK(profiles::IsMultipleProfilesEnabled());
268 return true; 269 return true;
269 } 270 }
270 if (profiles::IsMultipleProfilesEnabled()) { 271 if (profiles::IsMultipleProfilesEnabled()) {
271 #if defined(OS_CHROMEOS) 272 #if defined(OS_CHROMEOS)
272 // On ChromeOS we can always show this menu. 273 // On ChromeOS the menu will be always visible when it is possible to have
273 // TODO(skuhne): For now show this menu even if there is a single profile. 274 // two users logged in at the same time.
274 // This will have to change once we work out the right way to determine if 275 return ChromeShellDelegate::instance() &&
275 // the multi profile UX should be displayed. 276 ChromeShellDelegate::instance()->IsMultiProfilesEnabled();
276 return true;
277 #else 277 #else
278 return profiles::IsNewProfileManagementEnabled() || 278 return profiles::IsNewProfileManagementEnabled() ||
279 (g_browser_process->profile_manager() && 279 (g_browser_process->profile_manager() &&
280 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); 280 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1);
281 #endif 281 #endif
282 } 282 }
283 return false; 283 return false;
284 } 284 }
285 285
286 void AvatarMenuModel::RebuildMenu() { 286 void AvatarMenuModel::RebuildMenu() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 contents->GetController().LoadURL( 346 contents->GetController().LoadURL(
347 logout_url, content::Referrer(), 347 logout_url, content::Referrer(),
348 content::PAGE_TRANSITION_GENERATED, std::string()); 348 content::PAGE_TRANSITION_GENERATED, std::string());
349 349
350 // This object may be destructed when the menu closes but we need something 350 // This object may be destructed when the menu closes but we need something
351 // around to finish the sign-out process and close the profile windows. 351 // around to finish the sign-out process and close the profile windows.
352 new SignoutTracker(current_profile, GURL(landing_url), contents); 352 new SignoutTracker(current_profile, GURL(landing_url), contents);
353 353
354 return contents; // returned for testing purposes 354 return contents; // returned for testing purposes
355 } 355 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/chrome_shell_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698