Chromium Code Reviews| 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..75dc5a3306ce526b058db34520c7f3e7745f1575 100644 |
| --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc |
| +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc |
| @@ -27,6 +27,11 @@ |
| #include "content/public/browser/web_ui.h" |
| #include "grit/generated_resources.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 { |
| @@ -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("switchAppListProfile", |
| + base::Bind(&ManageProfileHandler::SwitchAppListProfile, |
| + base::Unretained(this))); |
| +#endif |
| } |
| void ManageProfileHandler::Observe( |
| @@ -309,6 +319,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 // else !defined(ENABLE_SETTINGS_APP) |
|
tapted
2013/01/26 01:10:08
comment should now be
// defined(ENABLE_SETTING
koz (OOO until 15th September)
2013/01/29 00:34:11
Done.
|
| + |
| void ManageProfileHandler::ProfileIconSelectionChanged( |
| const base::ListValue* args) { |
| DCHECK(args); |