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

Side by Side Diff: chrome/browser/ui/app_list/app_list_util.cc

Issue 12090062: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable tests on aura Created 7 years, 10 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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/app_list/app_list_util.h" 5 #include "chrome/browser/ui/app_list/app_list_util.h"
6 6
7 #include "base/file_util.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_prefs.h"
11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/common/chrome_constants.h"
13 #include "chrome/common/pref_names.h"
8 14
9 namespace chrome { 15 namespace chrome {
10 16
11 #if defined(OS_CHROMEOS) 17 #if defined(OS_CHROMEOS)
12 // Default implementation for ports which do not have this implemented. 18 // Default implementation for ports which do not have this implemented.
13 void InitAppList() {} 19 void InitAppList(Profile* profile) {}
14 #endif 20 #endif
15 21
22 #if defined(ENABLE_APP_LIST)
23 FilePath GetAppListProfilePath(const FilePath& user_data_dir) {
24 PrefService* local_state = g_browser_process->local_state();
25 DCHECK(local_state);
26
27 std::string app_list_profile;
28 if (local_state->HasPrefPath(prefs::kAppListProfile))
29 app_list_profile = local_state->GetString(prefs::kAppListProfile);
30
31 // If the user has no profile preference for the app launcher, default to the
32 // last browser profile used.
33 if (app_list_profile.empty() &&
34 local_state->HasPrefPath(prefs::kProfileLastUsed))
35 app_list_profile = local_state->GetString(prefs::kProfileLastUsed);
36
37 std::string profile_path = app_list_profile.empty() ?
38 chrome::kInitialProfile :
39 app_list_profile;
40
41 return user_data_dir.AppendASCII(profile_path);
42 }
43
44 void RegisterAppListPrefs(PrefServiceSimple* prefs) {
45 prefs->RegisterStringPref(prefs::kAppListProfile, "");
46 }
47 #endif // defined(ENABLE_APP_LIST)
48
49
16 } // namespace chrome 50 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_util.h ('k') | chrome/browser/ui/app_list/app_list_view_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698