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 14namespace profiles { 15 16bool IsMultipleProfilesEnabled() { 17#if defined(OS_ANDROID) 18 return false; 19#endif 20#if defined(OS_CHROMEOS) 21 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) 22 return false; 23#endif 24 25 return true; 26} 27 28bool IsNewProfileManagementEnabled() { 29 return CommandLine::ForCurrentProcess()->HasSwitch( 30 switches::kNewProfileManagement); 31} 32 33base::FilePath GetDefaultProfileDir( 34 const base::FilePath& user_data_dir) { 35 base::FilePath default_profile_dir(user_data_dir); 36 default_profile_dir = 37 default_profile_dir.AppendASCII(chrome::kInitialProfile); 38 return default_profile_dir; 39} 40 41base::FilePath GetProfilePrefsPath( 42 const base::FilePath &profile_dir) { 43 base::FilePath default_prefs_path(profile_dir); 44 default_prefs_path = default_prefs_path.Append(chrome::kPreferencesFilename); 45 return default_prefs_path; 46} 47 48void RegisterPrefs(PrefRegistrySimple* registry) { 49 registry->RegisterStringPref(prefs::kProfileLastUsed, std::string()); 50 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); 51 registry->RegisterListPref(prefs::kProfilesLastActive); 52} 53 54} // namespace profiles 55