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 { "manageProfilesManagedSignedInLabel", |
| 96 IDS_PROFILES_CREATE_MANAGED_SIGNED_IN_LABEL }, |
95 { "manageProfilesManagedNotSignedInLabel", | 97 { "manageProfilesManagedNotSignedInLabel", |
96 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LABEL }, | 98 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LABEL }, |
97 { "manageProfilesManagedNotSignedInLink", | 99 { "manageProfilesManagedNotSignedInLink", |
98 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LINK }, | 100 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LINK }, |
99 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, | 101 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, |
100 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, | 102 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, |
101 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, | 103 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, |
102 { "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_MANAGED_ADDENDUM }, | 104 { "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_MANAGED_ADDENDUM }, |
103 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, | 105 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, |
104 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, | 106 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 g_browser_process->profile_manager()->profile_shortcut_manager(); | 389 g_browser_process->profile_manager()->profile_shortcut_manager(); |
388 shortcut_manager->HasProfileShortcuts( | 390 shortcut_manager->HasProfileShortcuts( |
389 profile_path, base::Bind(&ManageProfileHandler::OnHasProfileShortcuts, | 391 profile_path, base::Bind(&ManageProfileHandler::OnHasProfileShortcuts, |
390 weak_factory_.GetWeakPtr())); | 392 weak_factory_.GetWeakPtr())); |
391 } | 393 } |
392 | 394 |
393 void ManageProfileHandler::RequestSignedInText(const base::ListValue* args) { | 395 void ManageProfileHandler::RequestSignedInText(const base::ListValue* args) { |
394 SigninManagerBase* manager = | 396 SigninManagerBase* manager = |
395 SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 397 SigninManagerFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
396 string16 username = UTF8ToUTF16(manager->GetAuthenticatedUsername()); | 398 string16 username = UTF8ToUTF16(manager->GetAuthenticatedUsername()); |
397 string16 text = string16(); | 399 StringValue username_value(username); |
398 if (!username.empty()) { | |
399 text = l10n_util::GetStringFUTF16( | |
400 IDS_PROFILES_CREATE_MANAGED_SIGNED_IN_LABEL, username); | |
401 } | |
402 StringValue text_value(text); | |
403 web_ui()->CallJavascriptFunction("CreateProfileOverlay.updateSignedInStatus", | 400 web_ui()->CallJavascriptFunction("CreateProfileOverlay.updateSignedInStatus", |
404 text_value); | 401 username_value); |
405 } | 402 } |
406 | 403 |
407 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { | 404 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { |
408 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 405 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
409 | 406 |
410 const base::FundamentalValue has_shortcuts_value(has_shortcuts); | 407 const base::FundamentalValue has_shortcuts_value(has_shortcuts); |
411 web_ui()->CallJavascriptFunction( | 408 web_ui()->CallJavascriptFunction( |
412 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); | 409 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); |
413 } | 410 } |
414 | 411 |
(...skipping 23 matching lines...) Expand all Loading... |
438 g_browser_process->profile_manager()->profile_shortcut_manager(); | 435 g_browser_process->profile_manager()->profile_shortcut_manager(); |
439 DCHECK(shortcut_manager); | 436 DCHECK(shortcut_manager); |
440 | 437 |
441 shortcut_manager->RemoveProfileShortcuts(profile_file_path); | 438 shortcut_manager->RemoveProfileShortcuts(profile_file_path); |
442 | 439 |
443 // Update the UI buttons. | 440 // Update the UI buttons. |
444 OnHasProfileShortcuts(false); | 441 OnHasProfileShortcuts(false); |
445 } | 442 } |
446 | 443 |
447 } // namespace options | 444 } // namespace options |
OLD | NEW |