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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void ManageProfileHandler::GetLocalizedValues( | 86 void ManageProfileHandler::GetLocalizedValues( |
87 DictionaryValue* localized_strings) { | 87 DictionaryValue* localized_strings) { |
88 DCHECK(localized_strings); | 88 DCHECK(localized_strings); |
89 | 89 |
90 static OptionsStringResource resources[] = { | 90 static OptionsStringResource resources[] = { |
91 { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL }, | 91 { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL }, |
92 { "manageProfilesDuplicateNameError", | 92 { "manageProfilesDuplicateNameError", |
93 IDS_PROFILES_MANAGE_DUPLICATE_NAME_ERROR }, | 93 IDS_PROFILES_MANAGE_DUPLICATE_NAME_ERROR }, |
94 { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL }, | 94 { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL }, |
95 { "manageProfilesLimitedNotSignedInLabel", | 95 { "manageProfilesManagedNotSignedInLabel", |
96 IDS_PROFILES_CREATE_LIMITED_NOT_SIGNED_IN_LABEL }, | 96 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LABEL }, |
97 { "manageProfilesLimitedNotSignedInLink", | 97 { "manageProfilesManagedNotSignedInLink", |
98 IDS_PROFILES_CREATE_LIMITED_NOT_SIGNED_IN_LINK }, | 98 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LINK }, |
99 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, | 99 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, |
100 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, | 100 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, |
101 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, | 101 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, |
| 102 { "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_MANAGED_ADDENDUM }, |
102 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, | 103 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, |
103 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, | 104 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, |
104 { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, | 105 { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, |
105 { "createProfileLocalError", IDS_PROFILES_CREATE_LOCAL_ERROR }, | 106 { "createProfileLocalError", IDS_PROFILES_CREATE_LOCAL_ERROR }, |
106 { "createProfileRemoteError", IDS_PROFILES_CREATE_REMOTE_ERROR }, | 107 { "createProfileRemoteError", IDS_PROFILES_CREATE_REMOTE_ERROR }, |
107 { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX }, | 108 { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX }, |
108 { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON }, | 109 { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON }, |
109 { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON }, | 110 { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON }, |
110 }; | 111 }; |
111 | 112 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 weak_factory_.GetWeakPtr())); | 390 weak_factory_.GetWeakPtr())); |
390 } | 391 } |
391 | 392 |
392 void ManageProfileHandler::RequestSignedInText(const base::ListValue* args) { | 393 void ManageProfileHandler::RequestSignedInText(const base::ListValue* args) { |
393 SigninManagerBase* manager = | 394 SigninManagerBase* manager = |
394 SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 395 SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
395 string16 username = UTF8ToUTF16(manager->GetAuthenticatedUsername()); | 396 string16 username = UTF8ToUTF16(manager->GetAuthenticatedUsername()); |
396 string16 text = string16(); | 397 string16 text = string16(); |
397 if (!username.empty()) { | 398 if (!username.empty()) { |
398 text = l10n_util::GetStringFUTF16( | 399 text = l10n_util::GetStringFUTF16( |
399 IDS_PROFILES_CREATE_LIMITED_SIGNED_IN_LABEL, username); | 400 IDS_PROFILES_CREATE_MANAGED_SIGNED_IN_LABEL, username); |
400 } | 401 } |
401 StringValue text_value(text); | 402 StringValue text_value(text); |
402 web_ui()->CallJavascriptFunction("CreateProfileOverlay.updateSignedInStatus", | 403 web_ui()->CallJavascriptFunction("CreateProfileOverlay.updateSignedInStatus", |
403 text_value); | 404 text_value); |
404 } | 405 } |
405 | 406 |
406 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { | 407 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { |
407 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 408 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
408 | 409 |
409 const base::FundamentalValue has_shortcuts_value(has_shortcuts); | 410 const base::FundamentalValue has_shortcuts_value(has_shortcuts); |
(...skipping 27 matching lines...) Expand all Loading... |
437 g_browser_process->profile_manager()->profile_shortcut_manager(); | 438 g_browser_process->profile_manager()->profile_shortcut_manager(); |
438 DCHECK(shortcut_manager); | 439 DCHECK(shortcut_manager); |
439 | 440 |
440 shortcut_manager->RemoveProfileShortcuts(profile_file_path); | 441 shortcut_manager->RemoveProfileShortcuts(profile_file_path); |
441 | 442 |
442 // Update the UI buttons. | 443 // Update the UI buttons. |
443 OnHasProfileShortcuts(false); | 444 OnHasProfileShortcuts(false); |
444 } | 445 } |
445 | 446 |
446 } // namespace options | 447 } // namespace options |
OLD | NEW |