profiles_state.cc revision 68043e1e95eeb07d5cae7aca370b26518b0867d6
1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/profiles/profiles_state.h" 6 7#include "base/command_line.h" 8#include "base/files/file_path.h" 9#include "base/prefs/pref_registry_simple.h" 10#include "chrome/common/chrome_constants.h" 11#include "chrome/common/chrome_switches.h" 12#include "chrome/common/pref_names.h" 13 14#if defined(OS_CHROMEOS) 15#include "chrome/browser/chromeos/login/user_manager.h" 16#endif 17 18namespace profiles { 19 20bool IsMultipleProfilesEnabled() { 21#if defined(OS_ANDROID) 22 return false; 23#endif 24#if defined(OS_CHROMEOS) 25 return chromeos::UserManager::IsMultipleProfilesAllowed(); 26#endif 27 28 return true; 29} 30 31bool IsNewProfileManagementEnabled() { 32 return CommandLine::ForCurrentProcess()->HasSwitch( 33 switches::kNewProfileManagement); 34} 35 36base::FilePath GetDefaultProfileDir( 37 const base::FilePath& user_data_dir) { 38 base::FilePath default_profile_dir(user_data_dir); 39 default_profile_dir = 40 default_profile_dir.AppendASCII(chrome::kInitialProfile); 41 return default_profile_dir; 42} 43 44base::FilePath GetProfilePrefsPath( 45 const base::FilePath &profile_dir) { 46 base::FilePath default_prefs_path(profile_dir); 47 default_prefs_path = default_prefs_path.Append(chrome::kPreferencesFilename); 48 return default_prefs_path; 49} 50 51void RegisterPrefs(PrefRegistrySimple* registry) { 52 registry->RegisterStringPref(prefs::kProfileLastUsed, std::string()); 53 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); 54 registry->RegisterListPref(prefs::kProfilesLastActive); 55} 56 57} // namespace profiles 58