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

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: 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
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 25481b144b9798e11336a0bf070f172e8bc5f77f..7b1574248644171d84cfa0ebdc7f3c153cc5aa3e 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
+#include "chrome/browser/ui/app_list/app_list_util.h"
tapted 2013/01/17 04:23:31 should perhaps be in the #ifdef below
koz (OOO until 15th September) 2013/01/18 05:37:33 Done.
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
@@ -27,6 +28,10 @@
#include "content/public/browser/web_ui.h"
#include "grit/generated_resources.h"
+#if defined(ENABLE_SETTINGS_APP)
+#include "content/public/browser/web_contents.h"
+#endif
+
namespace options {
namespace {
@@ -113,6 +118,11 @@ void ManageProfileHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("profileIconSelectionChanged",
base::Bind(&ManageProfileHandler::ProfileIconSelectionChanged,
base::Unretained(this)));
+#if defined(ENABLE_SETTINGS_APP)
+ web_ui()->RegisterMessageCallback("profilesAppListSwitch",
+ base::Bind(&ManageProfileHandler::ProfilesAppListSwitch,
+ base::Unretained(this)));
+#endif
}
void ManageProfileHandler::Observe(
@@ -309,6 +319,26 @@ void ManageProfileHandler::DeleteProfile(const ListValue* args) {
profile_file_path, desktop_type);
}
+void ManageProfileHandler::ProfilesAppListSwitch(const ListValue* args) {
+#if !defined(ENABLE_SETTINGS_APP)
+ return;
+#else
+ DCHECK(args);
+ if (!ProfileManager::IsMultipleProfilesEnabled())
+ return;
+
+ 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::UpdateProfilePath(profile_file_path);
+ // Close the settings app, since it will now be for the wrong profile.
+ web_ui()->GetWebContents()->Close();
+#endif // else !defined(ENABLE_SETTINGS_APP)
+}
+
void ManageProfileHandler::ProfileIconSelectionChanged(
const base::ListValue* args) {
DCHECK(args);

Powered by Google App Engine
This is Rietveld 408576698