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

Unified Diff: chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc

Issue 1536593004: Settings People Revamp: Implement Chrome Profile name/icon selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/settings/settings_manage_profile_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
similarity index 36%
copy from chrome/browser/ui/webui/options/manage_profile_handler.cc
copy to chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
index 6e4464a3d7f9f4a222e30e3670351cc8baa4b90d..a530704fa87579a1752d0997f3373f035eae56c7 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
@@ -1,14 +1,11 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/options/manage_profile_handler.h"
-
-#include <stddef.h>
+#include "chrome/browser/ui/webui/settings/settings_manage_profile_handler.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/macros.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/string_number_conversions.h"
@@ -16,7 +13,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/value_conversions.h"
#include "base/values.h"
-#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/gaia_info_update_service.h"
@@ -29,14 +25,12 @@
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/signin/signin_manager_factory.h"
-#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/options/options_handlers_helper.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
-#include "components/browser_sync/browser/profile_sync_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/browser_thread.h"
@@ -46,122 +40,16 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
-#if defined(ENABLE_SETTINGS_APP)
-#include "chrome/browser/ui/app_list/app_list_service.h"
-#include "content/public/browser/web_contents.h"
-#endif
-
-namespace options {
-
-namespace {
-
-const char kCreateProfileIdentifier[] = "create";
-const char kManageProfileIdentifier[] = "manage";
-
-// Given |args| from the WebUI, parses value 0 as a FilePath |profile_file_path|
-// and returns true on success.
-bool GetProfilePathFromArgs(const base::ListValue* args,
- base::FilePath* profile_file_path) {
- const base::Value* file_path_value;
- if (!args->Get(0, &file_path_value))
- return false;
- return base::GetValueAsFilePath(*file_path_value, profile_file_path);
-}
-
-void HandleLogDeleteUserDialogShown(const base::ListValue* args) {
- ProfileMetrics::LogProfileDeleteUser(
- ProfileMetrics::DELETE_PROFILE_SETTINGS_SHOW_WARNING);
-}
-
-} // namespace
+namespace settings {
-ManageProfileHandler::ManageProfileHandler()
- : weak_factory_(this) {
-}
-
-ManageProfileHandler::~ManageProfileHandler() {
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
- // Sync may be disabled in tests.
- if (service)
- service->RemoveObserver(this);
-}
-
-void ManageProfileHandler::GetLocalizedValues(
- base::DictionaryValue* localized_strings) {
- DCHECK(localized_strings);
-
- static OptionsStringResource resources[] = {
- { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL },
- { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL },
- { "manageProfilesExistingSupervisedUser",
- IDS_PROFILES_CREATE_LEGACY_SUPERVISED_USER_ERROR_EXISTS_REMOTELY },
- { "managedProfilesExistingLocalSupervisedUser",
- IDS_PROFILES_CREATE_LEGACY_SUPERVISED_USER_ERROR_EXISTS_LOCALLY },
- { "manageProfilesSupervisedSignedInLabel",
- IDS_PROFILES_CREATE_SUPERVISED_SIGNED_IN_LABEL },
- { "manageProfilesSupervisedNotSignedIn",
- IDS_PROFILES_CREATE_SUPERVISED_NOT_SIGNED_IN_HTML },
- { "manageProfilesSupervisedAccountDetailsOutOfDate",
- IDS_PROFILES_CREATE_SUPERVISED_ACCOUNT_DETAILS_OUT_OF_DATE_LABEL },
- { "manageProfilesSupervisedSignInAgainLink",
- IDS_PROFILES_GAIA_REAUTH_TITLE },
- { "manageProfilesConfirm", IDS_SAVE },
- { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE },
- { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL },
- { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE },
- { "disconnectManagedProfileTitle",
- IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE },
- { "disconnectManagedProfileOK",
- IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL },
- { "createProfileTitle", IDS_PROFILES_CREATE_TITLE },
- { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS },
- { "createProfileConfirm", IDS_ADD },
- { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX },
- { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON },
- { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON },
- { "importExistingSupervisedUserLink",
- IDS_IMPORT_EXISTING_LEGACY_SUPERVISED_USER_TITLE },
- };
-
- RegisterStrings(localized_strings, resources, arraysize(resources));
- RegisterTitle(localized_strings, "manageProfile", IDS_PROFILES_MANAGE_TITLE);
- RegisterTitle(localized_strings, "createProfile", IDS_PROFILES_CREATE_TITLE);
-
- base::string16 supervised_user_dashboard_url =
- base::ASCIIToUTF16(chrome::kLegacySupervisedUserManagementURL);
- base::string16 supervised_user_dashboard_display =
- base::ASCIIToUTF16(chrome::kLegacySupervisedUserManagementDisplayURL);
- localized_strings->SetString("deleteSupervisedProfileAddendum",
- l10n_util::GetStringFUTF16(IDS_PROFILES_DELETE_LEGACY_SUPERVISED_ADDENDUM,
- supervised_user_dashboard_url,
- supervised_user_dashboard_display));
-
- localized_strings->SetBoolean("profileShortcutsEnabled",
- ProfileShortcutManager::IsFeatureEnabled());
-
- GenerateSignedinUserSpecificStrings(localized_strings);
-}
-
-void ManageProfileHandler::InitializeHandler() {
+ManageProfileHandler::ManageProfileHandler(Profile* profile)
+ : profile_(profile), weak_factory_(this) {
g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
-
- Profile* profile = Profile::FromWebUI(web_ui());
- pref_change_registrar_.Init(profile->GetPrefs());
- pref_change_registrar_.Add(
- prefs::kSupervisedUserCreationAllowed,
- base::Bind(&ManageProfileHandler::OnCreateSupervisedUserPrefChange,
- base::Unretained(this)));
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetForProfile(profile);
- // Sync may be disabled for tests.
- if (service)
- service->AddObserver(this);
}
-void ManageProfileHandler::InitializePage() {
- SendExistingProfileNames();
- OnCreateSupervisedUserPrefChange();
+ManageProfileHandler::~ManageProfileHandler() {
+ g_browser_process->profile_manager()->
+ GetProfileInfoCache().RemoveObserver(this);
}
void ManageProfileHandler::RegisterMessages() {
@@ -171,23 +59,12 @@ void ManageProfileHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("requestDefaultProfileIcons",
base::Bind(&ManageProfileHandler::RequestDefaultProfileIcons,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("requestNewProfileDefaults",
- base::Bind(&ManageProfileHandler::RequestNewProfileDefaults,
- base::Unretained(this)));
web_ui()->RegisterMessageCallback("requestHasProfileShortcuts",
base::Bind(&ManageProfileHandler::RequestHasProfileShortcuts,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("requestCreateProfileUpdate",
- base::Bind(&ManageProfileHandler::RequestCreateProfileUpdate,
- base::Unretained(this)));
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
web_ui()->RegisterMessageCallback("addProfileShortcut",
base::Bind(&ManageProfileHandler::AddProfileShortcut,
base::Unretained(this)));
@@ -197,129 +74,38 @@ void ManageProfileHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("refreshGaiaPicture",
base::Bind(&ManageProfileHandler::RefreshGaiaPicture,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "showDisconnectManagedProfileDialog",
- base::Bind(&ManageProfileHandler::ShowDisconnectManagedProfileDialog,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback("logDeleteUserDialogShown",
- base::Bind(&HandleLogDeleteUserDialogShown));
-}
-
-void ManageProfileHandler::Uninitialize() {
- g_browser_process->profile_manager()->
- GetProfileInfoCache().RemoveObserver(this);
-}
-
-void ManageProfileHandler::OnProfileAdded(const base::FilePath& profile_path) {
- SendExistingProfileNames();
-}
-
-void ManageProfileHandler::OnProfileWasRemoved(
- const base::FilePath& profile_path,
- const base::string16& profile_name) {
- SendExistingProfileNames();
}
void ManageProfileHandler::OnProfileNameChanged(
const base::FilePath& profile_path,
const base::string16& old_profile_name) {
- base::StringValue value(kManageProfileIdentifier);
- SendProfileIconsAndNames(value);
+ SendAvailableIcons();
}
void ManageProfileHandler::OnProfileAvatarChanged(
const base::FilePath& profile_path) {
- base::StringValue value(kManageProfileIdentifier);
- SendProfileIconsAndNames(value);
-}
-
-void ManageProfileHandler::OnStateChanged() {
- RequestCreateProfileUpdate(NULL);
-}
-
-void ManageProfileHandler::GenerateSignedinUserSpecificStrings(
- base::DictionaryValue* dictionary) {
- std::string username;
- std::string domain_name;
-
-#if !defined(OS_CHROMEOS)
- Profile* profile = Profile::FromWebUI(web_ui());
- DCHECK(profile);
- SigninManagerBase* manager = SigninManagerFactory::GetForProfile(profile);
- if (manager) {
- username = manager->GetAuthenticatedAccountInfo().email;
- // If there is no one logged in or if the profile name is empty then the
- // domain name is empty. This happens in browser tests.
- if (!username.empty()) {
- domain_name = "<span id=disconnect-managed-profile-domain-name>" +
- gaia::ExtractDomainName(username) + "</span>";
- }
- }
-#endif
-
- dictionary->SetString(
- "disconnectManagedProfileDomainInformation",
- l10n_util::GetStringFUTF16(
- IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_DOMAIN_INFORMATION,
- base::ASCIIToUTF16(domain_name)));
-
- dictionary->SetString(
- "disconnectManagedProfileText",
- l10n_util::GetStringFUTF16(
- IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT,
- base::UTF8ToUTF16(username),
- base::UTF8ToUTF16(chrome::kSyncGoogleDashboardURL)));
+ SendAvailableIcons();
}
void ManageProfileHandler::RequestDefaultProfileIcons(
const base::ListValue* args) {
- std::string mode;
- bool ok = args->GetString(0, &mode);
- DCHECK(ok);
- DCHECK(mode == kCreateProfileIdentifier || mode == kManageProfileIdentifier);
- if (ok) {
- base::StringValue value(mode);
- SendProfileIconsAndNames(value);
- }
+ SendAvailableIcons();
}
-void ManageProfileHandler::RequestNewProfileDefaults(
- const base::ListValue* args) {
- const ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- const size_t icon_index = cache.ChooseAvatarIconIndexForNewProfile();
-
- base::DictionaryValue profile_info;
- profile_info.SetString("name", cache.ChooseNameForNewProfile(icon_index));
- profile_info.SetString("iconURL",
- profiles::GetDefaultAvatarIconUrl(icon_index));
-
- web_ui()->CallJavascriptFunction(
- "ManageProfileOverlay.receiveNewProfileDefaults", profile_info);
-}
-
-void ManageProfileHandler::SendProfileIconsAndNames(
- const base::StringValue& mode) {
+void ManageProfileHandler::SendAvailableIcons() {
base::ListValue image_url_list;
- base::ListValue default_name_list;
-
const ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
- // In manage mode, first add the GAIA picture if it is available. No GAIA
- // picture in create mode.
- if (mode.GetString() == kManageProfileIdentifier) {
- Profile* profile = Profile::FromWebUI(web_ui());
- size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
- if (profile_index != std::string::npos) {
- const gfx::Image* icon =
- cache.GetGAIAPictureOfProfileAtIndex(profile_index);
- if (icon) {
- gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true);
- gaia_picture_url_ = webui::GetBitmapDataUrl(icon2.AsBitmap());
- image_url_list.AppendString(gaia_picture_url_);
- default_name_list.AppendString(std::string());
- }
+ // First add the GAIA picture if it is available.
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
+ if (profile_index != std::string::npos) {
+ const gfx::Image* icon =
+ cache.GetGAIAPictureOfProfileAtIndex(profile_index);
+ if (icon) {
+ gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true);
+ gaia_picture_url_ = webui::GetBitmapDataUrl(icon2.AsBitmap());
+ image_url_list.AppendString(gaia_picture_url_);
}
}
@@ -327,52 +113,21 @@ void ManageProfileHandler::SendProfileIconsAndNames(
for (size_t i = 0; i < profiles::GetDefaultAvatarIconCount(); i++) {
std::string url = profiles::GetDefaultAvatarIconUrl(i);
image_url_list.AppendString(url);
- default_name_list.AppendString(cache.ChooseNameForNewProfile(i));
- }
-
- web_ui()->CallJavascriptFunction(
- "ManageProfileOverlay.receiveDefaultProfileIconsAndNames", mode,
- image_url_list, default_name_list);
-}
-
-void ManageProfileHandler::SendExistingProfileNames() {
- const ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- base::DictionaryValue profile_name_dict;
- for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) {
- profile_name_dict.SetBoolean(
- base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(i)), true);
}
web_ui()->CallJavascriptFunction(
- "ManageProfileOverlay.receiveExistingProfileNames", profile_name_dict);
-}
-
-void ManageProfileHandler::ShowDisconnectManagedProfileDialog(
- const base::ListValue* args) {
- base::DictionaryValue replacements;
- GenerateSignedinUserSpecificStrings(&replacements);
- web_ui()->CallJavascriptFunction(
- "ManageProfileOverlay.showDisconnectManagedProfileDialog", replacements);
+ "settings.SyncPrivateApi.receiveAvailableIcons",
+ image_url_list);
}
void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) {
DCHECK(args);
- base::FilePath profile_file_path;
- if (!GetProfilePathFromArgs(args, &profile_file_path))
- return;
-
- Profile* profile =
- g_browser_process->profile_manager()->GetProfile(profile_file_path);
- if (!profile)
- return;
-
std::string icon_url;
- if (!args->GetString(1, &icon_url))
+ if (!args->GetString(0, &icon_url))
return;
- PrefService* pref_service = profile->GetPrefs();
+ PrefService* pref_service = profile_->GetPrefs();
// Updating the profile preferences will cause the cache to be updated.
// Metrics logging variable.
@@ -398,55 +153,26 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) {
// Only default avatars and Gaia account photos are supported.
CHECK(false);
}
- ProfileMetrics::LogProfileUpdate(profile_file_path);
+ ProfileMetrics::LogProfileUpdate(profile_->GetPath());
- if (profile->IsLegacySupervised())
+ if (profile_->IsLegacySupervised())
return;
base::string16 new_profile_name;
- if (!args->GetString(2, &new_profile_name))
+ if (!args->GetString(1, &new_profile_name))
return;
base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name);
CHECK(!new_profile_name.empty());
- profiles::UpdateProfileName(profile, new_profile_name);
-}
-
-#if defined(ENABLE_SETTINGS_APP)
-void ManageProfileHandler::SwitchAppListProfile(const base::ListValue* args) {
- DCHECK(args);
- DCHECK(profiles::IsMultipleProfilesEnabled());
-
- const base::Value* file_path_value;
- base::FilePath profile_file_path;
- if (!args->Get(0, &file_path_value) ||
- !base::GetValueAsFilePath(*file_path_value, &profile_file_path))
- return;
-
- AppListService* app_list_service = AppListService::Get(
- options::helper::GetDesktopType(web_ui()));
- app_list_service->SetProfilePath(profile_file_path);
- app_list_service->Show();
-
- // Close the settings app, since it will now be for the wrong profile.
- web_ui()->GetWebContents()->Close();
+ profiles::UpdateProfileName(profile_, new_profile_name);
}
-#endif // defined(ENABLE_SETTINGS_APP)
void ManageProfileHandler::ProfileIconSelectionChanged(
const base::ListValue* args) {
DCHECK(args);
- base::FilePath profile_file_path;
- if (!GetProfilePathFromArgs(args, &profile_file_path))
- return;
-
- // Currently this only supports editing the current profile's info.
- if (profile_file_path != Profile::FromWebUI(web_ui())->GetPath())
- return;
-
std::string icon_url;
- if (!args->GetString(1, &icon_url))
+ if (!args->GetString(0, &icon_url))
return;
if (icon_url != gaia_picture_url_)
@@ -457,7 +183,7 @@ void ManageProfileHandler::ProfileIconSelectionChanged(
// or the first name.
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path);
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
if (profile_index == std::string::npos)
return;
base::string16 gaia_name = cache.GetNameOfProfileAtIndex(profile_index);
@@ -465,9 +191,9 @@ void ManageProfileHandler::ProfileIconSelectionChanged(
return;
base::StringValue gaia_name_value(gaia_name);
- base::StringValue mode_value(kManageProfileIdentifier);
- web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
- gaia_name_value, mode_value);
+ web_ui()->CallJavascriptFunction(
+ "settings.SyncPrivateApi.setProfileName",
+ gaia_name_value);
}
void ManageProfileHandler::RequestHasProfileShortcuts(
@@ -475,13 +201,9 @@ void ManageProfileHandler::RequestHasProfileShortcuts(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(ProfileShortcutManager::IsFeatureEnabled());
- base::FilePath profile_file_path;
- if (!GetProfilePathFromArgs(args, &profile_file_path))
- return;
-
const ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path);
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
if (profile_index == std::string::npos)
return;
@@ -498,76 +220,34 @@ void ManageProfileHandler::RequestHasProfileShortcuts(
weak_factory_.GetWeakPtr()));
}
-void ManageProfileHandler::RequestCreateProfileUpdate(
- const base::ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui());
- SigninManagerBase* manager =
- SigninManagerFactory::GetForProfile(profile);
- base::string16 username =
- base::UTF8ToUTF16(manager->GetAuthenticatedAccountInfo().email);
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetForProfile(profile);
- GoogleServiceAuthError::State state = GoogleServiceAuthError::NONE;
-
- // |service| might be null if Sync is disabled from the command line.
- if (service)
- state = service->GetAuthError().state();
-
- bool has_error = (!service ||
- state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS ||
- state == GoogleServiceAuthError::USER_NOT_SIGNED_UP ||
- state == GoogleServiceAuthError::ACCOUNT_DELETED ||
- state == GoogleServiceAuthError::ACCOUNT_DISABLED);
- web_ui()->CallJavascriptFunction("CreateProfileOverlay.updateSignedInStatus",
- base::StringValue(username),
- base::FundamentalValue(has_error));
-
- OnCreateSupervisedUserPrefChange();
-}
-
-void ManageProfileHandler::OnCreateSupervisedUserPrefChange() {
- PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
- base::FundamentalValue allowed(
- prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed));
- web_ui()->CallJavascriptFunction(
- "CreateProfileOverlay.updateSupervisedUsersAllowed", allowed);
-}
-
void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
const base::FundamentalValue has_shortcuts_value(has_shortcuts);
web_ui()->CallJavascriptFunction(
- "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value);
+ "settings.SyncPrivateApi.receiveHasProfileShortcuts",
+ has_shortcuts_value);
}
void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) {
- base::FilePath profile_file_path;
- if (!GetProfilePathFromArgs(args, &profile_file_path))
- return;
-
DCHECK(ProfileShortcutManager::IsFeatureEnabled());
ProfileShortcutManager* shortcut_manager =
g_browser_process->profile_manager()->profile_shortcut_manager();
DCHECK(shortcut_manager);
- shortcut_manager->CreateProfileShortcut(profile_file_path);
+ shortcut_manager->CreateProfileShortcut(profile_->GetPath());
// Update the UI buttons.
OnHasProfileShortcuts(true);
}
void ManageProfileHandler::RemoveProfileShortcut(const base::ListValue* args) {
- base::FilePath profile_file_path;
- if (!GetProfilePathFromArgs(args, &profile_file_path))
- return;
-
DCHECK(ProfileShortcutManager::IsFeatureEnabled());
ProfileShortcutManager* shortcut_manager =
g_browser_process->profile_manager()->profile_shortcut_manager();
DCHECK(shortcut_manager);
- shortcut_manager->RemoveProfileShortcuts(profile_file_path);
+ shortcut_manager->RemoveProfileShortcuts(profile_->GetPath());
// Update the UI buttons.
OnHasProfileShortcuts(false);
@@ -577,4 +257,4 @@ void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) {
profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui()));
}
-} // namespace options
+} // namespace settings
« no previous file with comments | « chrome/browser/ui/webui/settings/settings_manage_profile_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698