| OLD | NEW |
| (Empty) |
| 1 // Copyright 2012 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/ui/app_list/app_list_util.h" | |
| 6 | |
| 7 #include "base/file_util.h" | |
| 8 #include "base/prefs/pref_registry_simple.h" | |
| 9 #include "base/prefs/pref_service.h" | |
| 10 #include "build/build_config.h" | |
| 11 #include "chrome/browser/browser_process.h" | |
| 12 #include "chrome/browser/extensions/extension_prefs.h" | |
| 13 #include "chrome/common/chrome_constants.h" | |
| 14 #include "chrome/common/pref_names.h" | |
| 15 | |
| 16 namespace chrome { | |
| 17 | |
| 18 #if defined(OS_CHROMEOS) | |
| 19 // Default implementation for ports which do not have this implemented. | |
| 20 void InitAppList(Profile* profile) {} | |
| 21 #endif | |
| 22 | |
| 23 #if defined(ENABLE_APP_LIST) | |
| 24 base::FilePath GetAppListProfilePath(const base::FilePath& user_data_dir) { | |
| 25 PrefService* local_state = g_browser_process->local_state(); | |
| 26 DCHECK(local_state); | |
| 27 | |
| 28 std::string app_list_profile; | |
| 29 if (local_state->HasPrefPath(prefs::kAppListProfile)) | |
| 30 app_list_profile = local_state->GetString(prefs::kAppListProfile); | |
| 31 | |
| 32 // If the user has no profile preference for the app launcher, default to the | |
| 33 // last browser profile used. | |
| 34 if (app_list_profile.empty() && | |
| 35 local_state->HasPrefPath(prefs::kProfileLastUsed)) | |
| 36 app_list_profile = local_state->GetString(prefs::kProfileLastUsed); | |
| 37 | |
| 38 std::string profile_path = app_list_profile.empty() ? | |
| 39 chrome::kInitialProfile : | |
| 40 app_list_profile; | |
| 41 | |
| 42 return user_data_dir.AppendASCII(profile_path); | |
| 43 } | |
| 44 | |
| 45 void RegisterAppListPrefs(PrefRegistrySimple* registry) { | |
| 46 registry->RegisterStringPref(prefs::kAppListProfile, ""); | |
| 47 } | |
| 48 #endif // defined(ENABLE_APP_LIST) | |
| 49 | |
| 50 | |
| 51 } // namespace chrome | |
| OLD | NEW |