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

Unified Diff: chrome/browser/ui/app_list/app_list_service_impl.cc

Issue 18421007: [win] Set the profile path when enabling the app launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, and fix a few things Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/app_list_service_impl.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc
index c763cdd3cd47307ae903ae2c3f6eceb8afb90fb4..812a20fef409286fa190c26385102d9a9c1ae5bb 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_service_impl.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/app_list/app_list_service_impl.h"
+#include "apps/pref_names.h"
+#include "base/command_line.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/time/time.h"
@@ -11,6 +13,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
@@ -66,6 +69,11 @@ void RecordDailyEventFrequency(
}
}
+void SetAppListEnabledPreference(bool enabled) {
+ PrefService* local_state = g_browser_process->local_state();
+ local_state->SetBoolean(apps::prefs::kAppLauncherHasBeenEnabled, enabled);
+}
+
} // namespace
// static
@@ -128,13 +136,24 @@ base::FilePath AppListServiceImpl::GetProfilePath(
chrome::kInitialProfile :
app_list_profile;
- return user_data_dir.AppendASCII(profile_path);
+ if (!user_data_dir.empty())
+ return user_data_dir.AppendASCII(profile_path);
+
+ return g_browser_process->profile_manager()->
+ user_data_dir().AppendASCII(profile_path);
+}
+
+void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) {
+ g_browser_process->local_state()->SetString(
+ prefs::kAppListProfile,
+ profile_path.BaseName().MaybeAsASCII());
}
AppListControllerDelegate* AppListServiceImpl::CreateControllerDelegate() {
return NULL;
}
+void AppListServiceImpl::CreateShortcut() {}
void AppListServiceImpl::OnSigninStatusChanged() {}
// We need to watch for profile removal to keep kAppListProfile updated.
@@ -158,16 +177,16 @@ void AppListServiceImpl::Observe(
OnSigninStatusChanged();
}
-void AppListServiceImpl::SetAppListProfile(
- const base::FilePath& profile_file_path) {
+void AppListServiceImpl::ShowForSavedProfile() {
profile_loader_.LoadProfileInvalidatingOtherLoads(
- profile_file_path, base::Bind(&AppListServiceImpl::ShowAppList,
- weak_factory_.GetWeakPtr()));
+ GetProfilePath(base::FilePath()),
+ base::Bind(&AppListServiceImpl::ShowAppList, weak_factory_.GetWeakPtr()));
}
-void AppListServiceImpl::ShowForSavedProfile() {
- SetAppListProfile(GetProfilePath(
- g_browser_process->profile_manager()->user_data_dir()));
+void AppListServiceImpl::EnableAppList(Profile* initial_profile) {
+ SetAppListEnabledPreference(true);
+ SetProfilePath(initial_profile->GetPath());
+ CreateShortcut();
}
Profile* AppListServiceImpl::GetCurrentAppListProfile() {
@@ -190,9 +209,10 @@ void AppListServiceImpl::InvalidatePendingProfileLoads() {
profile_loader_.InvalidatePendingProfileLoads();
}
-void AppListServiceImpl::SaveProfilePathToLocalState(
- const base::FilePath& profile_file_path) {
- g_browser_process->local_state()->SetString(
- prefs::kAppListProfile,
- profile_file_path.BaseName().MaybeAsASCII());
+void AppListServiceImpl::SharedDesktopInit(Profile* initial_profile) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppList))
+ EnableAppList(initial_profile);
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppList))
+ SetAppListEnabledPreference(false);
}

Powered by Google App Engine
This is Rietveld 408576698