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

Unified Diff: chrome/browser/ui/webui/options/manage_profile_handler.cc

Issue 11968034: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: git://nomatter.syd/chromium/src.git@master
Patch Set: private Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/manage_profile_handler.cc
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index 9737f17c8ad721ea8fbb9bc5d3096fa5bd5e403f..b24a213bb9a4db85486cfce767e5a39733c9a50e 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -28,6 +28,11 @@
#include "grit/generated_resources.h"
#include "ui/webui/web_ui_util.h"
+#if defined(ENABLE_SETTINGS_APP)
+#include "chrome/browser/ui/app_list/app_list_util.h"
+#include "content/public/browser/web_contents.h"
+#endif
+
namespace options {
namespace {
@@ -114,6 +119,11 @@ void ManageProfileHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("profileIconSelectionChanged",
base::Bind(&ManageProfileHandler::ProfileIconSelectionChanged,
base::Unretained(this)));
+#if defined(ENABLE_SETTINGS_APP)
+ web_ui()->RegisterMessageCallback("switchAppListProfile",
+ base::Bind(&ManageProfileHandler::SwitchAppListProfile,
+ base::Unretained(this)));
+#endif
}
void ManageProfileHandler::Observe(
@@ -310,6 +320,23 @@ void ManageProfileHandler::DeleteProfile(const ListValue* args) {
profile_file_path, desktop_type);
}
+#if defined(ENABLE_SETTINGS_APP)
+void ManageProfileHandler::SwitchAppListProfile(const ListValue* args) {
+ DCHECK(args);
+ DCHECK(ProfileManager::IsMultipleProfilesEnabled());
+
+ const Value* file_path_value;
+ FilePath profile_file_path;
+ if (!args->Get(0, &file_path_value) ||
+ !base::GetValueAsFilePath(*file_path_value, &profile_file_path))
+ return;
+
+ chrome::SetAppListProfile(profile_file_path);
+ // Close the settings app, since it will now be for the wrong profile.
+ web_ui()->GetWebContents()->Close();
+}
+#endif // defined(ENABLE_SETTINGS_APP)
+
void ManageProfileHandler::ProfileIconSelectionChanged(
const base::ListValue* args) {
DCHECK(args);
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698