| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 base::DictionaryValue* localized_strings) { | 80 base::DictionaryValue* localized_strings) { |
| 81 DCHECK(localized_strings); | 81 DCHECK(localized_strings); |
| 82 | 82 |
| 83 static OptionsStringResource resources[] = { | 83 static OptionsStringResource resources[] = { |
| 84 { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL }, | 84 { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL }, |
| 85 { "manageProfilesDuplicateNameError", | 85 { "manageProfilesDuplicateNameError", |
| 86 IDS_PROFILES_MANAGE_DUPLICATE_NAME_ERROR }, | 86 IDS_PROFILES_MANAGE_DUPLICATE_NAME_ERROR }, |
| 87 { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL }, | 87 { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL }, |
| 88 { "manageProfilesExistingSupervisedUser", | 88 { "manageProfilesExistingSupervisedUser", |
| 89 IDS_PROFILES_CREATE_EXISTING_SUPERVISED_USER_ERROR }, | 89 IDS_PROFILES_CREATE_EXISTING_SUPERVISED_USER_ERROR }, |
| 90 { "manageProfilesManagedSignedInLabel", | 90 { "manageProfilesSupervisedSignedInLabel", |
| 91 IDS_PROFILES_CREATE_SUPERVISED_SIGNED_IN_LABEL }, | 91 IDS_PROFILES_CREATE_SUPERVISED_SIGNED_IN_LABEL }, |
| 92 { "manageProfilesManagedNotSignedInLabel", | 92 { "manageProfilesSupervisedNotSignedInLabel", |
| 93 IDS_PROFILES_CREATE_SUPERVISED_NOT_SIGNED_IN_LABEL }, | 93 IDS_PROFILES_CREATE_SUPERVISED_NOT_SIGNED_IN_LABEL }, |
| 94 { "manageProfilesManagedAccountDetailsOutOfDate", | 94 { "manageProfilesSupervisedAccountDetailsOutOfDate", |
| 95 IDS_PROFILES_CREATE_SUPERVISED_ACCOUNT_DETAILS_OUT_OF_DATE_LABEL }, | 95 IDS_PROFILES_CREATE_SUPERVISED_ACCOUNT_DETAILS_OUT_OF_DATE_LABEL }, |
| 96 { "manageProfilesManagedSignInAgainLink", | 96 { "manageProfilesSupervisedSignInAgainLink", |
| 97 IDS_PROFILES_CREATE_SUPERVISED_SIGN_IN_AGAIN_LINK }, | 97 IDS_PROFILES_CREATE_SUPERVISED_SIGN_IN_AGAIN_LINK }, |
| 98 { "manageProfilesManagedNotSignedInLink", | 98 { "manageProfilesSupervisedNotSignedInLink", |
| 99 IDS_PROFILES_CREATE_SUPERVISED_NOT_SIGNED_IN_LINK }, | 99 IDS_PROFILES_CREATE_SUPERVISED_NOT_SIGNED_IN_LINK }, |
| 100 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, | 100 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, |
| 101 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, | 101 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, |
| 102 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, | 102 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, |
| 103 { "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_SUPERVISED_ADDENDUM }, | 103 { "deleteSupervisedProfileAddendum", |
| 104 IDS_PROFILES_DELETE_SUPERVISED_ADDENDUM }, |
| 104 { "disconnectManagedProfileTitle", | 105 { "disconnectManagedProfileTitle", |
| 105 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE }, | 106 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE }, |
| 106 { "disconnectManagedProfileOK", | 107 { "disconnectManagedProfileOK", |
| 107 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL }, | 108 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL }, |
| 108 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, | 109 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, |
| 109 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, | 110 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, |
| 110 { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, | 111 { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, |
| 111 { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX }, | 112 { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX }, |
| 112 { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON }, | 113 { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON }, |
| 113 { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON }, | 114 { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON }, |
| 114 { "importExistingManagedUserLink", | 115 { "importExistingSupervisedUserLink", |
| 115 IDS_PROFILES_IMPORT_EXISTING_SUPERVISED_USER_LINK }, | 116 IDS_PROFILES_IMPORT_EXISTING_SUPERVISED_USER_LINK }, |
| 116 { "signInToImportManagedUsers", | 117 { "signInToImportSupervisedUsers", |
| 117 IDS_PROFILES_IMPORT_SUPERVISED_USER_NOT_SIGNED_IN }, | 118 IDS_PROFILES_IMPORT_SUPERVISED_USER_NOT_SIGNED_IN }, |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 RegisterStrings(localized_strings, resources, arraysize(resources)); | 121 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 121 RegisterTitle(localized_strings, "manageProfile", | 122 RegisterTitle(localized_strings, "manageProfile", |
| 122 IDS_PROFILES_MANAGE_TITLE); | 123 IDS_PROFILES_MANAGE_TITLE); |
| 123 RegisterTitle(localized_strings, "createProfile", | 124 RegisterTitle(localized_strings, "createProfile", |
| 124 IDS_PROFILES_CREATE_TITLE); | 125 IDS_PROFILES_CREATE_TITLE); |
| 125 | 126 |
| 126 localized_strings->SetBoolean("profileShortcutsEnabled", | 127 localized_strings->SetBoolean("profileShortcutsEnabled", |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 base::FundamentalValue(has_error)); | 481 base::FundamentalValue(has_error)); |
| 481 | 482 |
| 482 OnCreateSupervisedUserPrefChange(); | 483 OnCreateSupervisedUserPrefChange(); |
| 483 } | 484 } |
| 484 | 485 |
| 485 void ManageProfileHandler::OnCreateSupervisedUserPrefChange() { | 486 void ManageProfileHandler::OnCreateSupervisedUserPrefChange() { |
| 486 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 487 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 487 base::FundamentalValue allowed( | 488 base::FundamentalValue allowed( |
| 488 prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed)); | 489 prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed)); |
| 489 web_ui()->CallJavascriptFunction( | 490 web_ui()->CallJavascriptFunction( |
| 490 "CreateProfileOverlay.updateManagedUsersAllowed", allowed); | 491 "CreateProfileOverlay.updateSupervisedUsersAllowed", allowed); |
| 491 } | 492 } |
| 492 | 493 |
| 493 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { | 494 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { |
| 494 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 495 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 495 | 496 |
| 496 const base::FundamentalValue has_shortcuts_value(has_shortcuts); | 497 const base::FundamentalValue has_shortcuts_value(has_shortcuts); |
| 497 web_ui()->CallJavascriptFunction( | 498 web_ui()->CallJavascriptFunction( |
| 498 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); | 499 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); |
| 499 } | 500 } |
| 500 | 501 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 528 | 529 |
| 529 // Update the UI buttons. | 530 // Update the UI buttons. |
| 530 OnHasProfileShortcuts(false); | 531 OnHasProfileShortcuts(false); |
| 531 } | 532 } |
| 532 | 533 |
| 533 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { | 534 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
| 534 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); | 535 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); |
| 535 } | 536 } |
| 536 | 537 |
| 537 } // namespace options | 538 } // namespace options |
| OLD | NEW |