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

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate.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 | « chrome/browser/profiles/avatar_menu_model.cc ('k') | no next file » | 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/ui/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include "apps/native_app_window.h" 7 #include "apps/native_app_window.h"
8 #include "apps/shell_window.h" 8 #include "apps/shell_window.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "ash/host/root_window_host_factory.h" 10 #include "ash/host/root_window_host_factory.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/ui/host_desktop.h" 34 #include "chrome/browser/ui/host_desktop.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
37 #include "grit/chromium_strings.h" 37 #include "grit/chromium_strings.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "ui/aura/window.h" 39 #include "ui/aura/window.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 41
42 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
43 #include "chrome/browser/chromeos/login/default_pinned_apps_field_trial.h" 43 #include "chrome/browser/chromeos/login/default_pinned_apps_field_trial.h"
44 #include "chrome/browser/chromeos/login/user_manager.h"
44 #endif 45 #endif
45 46
46 // static 47 // static
47 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; 48 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL;
48 49
49 namespace { 50 namespace {
50 51
51 void RestoreTabUsingProfile(Profile* profile) { 52 void RestoreTabUsingProfile(Profile* profile) {
52 TabRestoreService* service = TabRestoreServiceFactory::GetForProfile(profile); 53 TabRestoreService* service = TabRestoreServiceFactory::GetForProfile(profile);
53 service->RestoreMostRecentEntry(NULL, chrome::HOST_DESKTOP_TYPE_ASH); 54 service->RestoreMostRecentEntry(NULL, chrome::HOST_DESKTOP_TYPE_ASH);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 instance_ = this; 105 instance_ = this;
105 PlatformInit(); 106 PlatformInit();
106 } 107 }
107 108
108 ChromeShellDelegate::~ChromeShellDelegate() { 109 ChromeShellDelegate::~ChromeShellDelegate() {
109 if (instance_ == this) 110 if (instance_ == this)
110 instance_ = NULL; 111 instance_ = NULL;
111 } 112 }
112 113
113 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { 114 bool ChromeShellDelegate::IsMultiProfilesEnabled() const {
114 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); 115 // TODO(skuhne): There is a function named profiles::IsMultiProfilesEnabled
116 // which does similar things - but it is not the same. We should investigate
117 // if these two could be folded together.
118 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles))
119 return false;
120 #if defined(OS_CHROMEOS)
121 // If there is a user manager, we need to see that we can at least have 2
122 // simultaneous users to allow this feature.
123 if (chromeos::UserManager::IsInitialized() &&
124 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile().size() +
125 chromeos::UserManager::Get()->GetLoggedInUsers().size() <= 1)
126 return false;
127 #endif
128 return true;
115 } 129 }
116 130
117 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { 131 bool ChromeShellDelegate::IsRunningInForcedAppMode() const {
118 return chrome::IsRunningInForcedAppMode(); 132 return chrome::IsRunningInForcedAppMode();
119 } 133 }
120 134
121 void ChromeShellDelegate::Exit() { 135 void ChromeShellDelegate::Exit() {
122 chrome::AttemptUserExit(); 136 chrome::AttemptUserExit();
123 } 137 }
124 138
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 return browser; 443 return browser;
430 return chrome::FindOrCreateTabbedBrowser( 444 return chrome::FindOrCreateTabbedBrowser(
431 ProfileManager::GetDefaultProfileOrOffTheRecord(), 445 ProfileManager::GetDefaultProfileOrOffTheRecord(),
432 chrome::HOST_DESKTOP_TYPE_ASH); 446 chrome::HOST_DESKTOP_TYPE_ASH);
433 } 447 }
434 448
435 keyboard::KeyboardControllerProxy* 449 keyboard::KeyboardControllerProxy*
436 ChromeShellDelegate::CreateKeyboardControllerProxy() { 450 ChromeShellDelegate::CreateKeyboardControllerProxy() {
437 return new AshKeyboardControllerProxy(); 451 return new AshKeyboardControllerProxy();
438 } 452 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698