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 17 matching lines...) Expand all Loading... | |
28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
30 #include "chrome/browser/ui/browser_finder.h" | 30 #include "chrome/browser/ui/browser_finder.h" |
31 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" | 31 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" |
32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
34 #include "components/signin/core/browser/signin_manager.h" | 34 #include "components/signin/core/browser/signin_manager.h" |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
37 #include "content/public/browser/web_ui.h" | 37 #include "content/public/browser/web_ui.h" |
38 #include "google_apis/gaia/gaia_auth_util.h" | |
38 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
39 #include "grit/google_chrome_strings.h" | 40 #include "grit/google_chrome_strings.h" |
40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/base/webui/web_ui_util.h" | 42 #include "ui/base/webui/web_ui_util.h" |
42 | 43 |
43 #if defined(ENABLE_SETTINGS_APP) | 44 #if defined(ENABLE_SETTINGS_APP) |
44 #include "chrome/browser/ui/app_list/app_list_service.h" | 45 #include "chrome/browser/ui/app_list/app_list_service.h" |
45 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
46 #endif | 47 #endif |
47 | 48 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 { "manageProfilesManagedNotSignedInLink", | 99 { "manageProfilesManagedNotSignedInLink", |
99 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LINK }, | 100 IDS_PROFILES_CREATE_MANAGED_NOT_SIGNED_IN_LINK }, |
100 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, | 101 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, |
101 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, | 102 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, |
102 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, | 103 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, |
103 { "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_MANAGED_ADDENDUM }, | 104 { "deleteManagedProfileAddendum", IDS_PROFILES_DELETE_MANAGED_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 { "disconnectManagedProfileText", | |
109 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT }, | |
110 { "disconnectManagedProfileLearnMore", | |
111 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_LEARN_MORE }, | |
112 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, | 109 { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, |
113 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, | 110 { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, |
114 { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, | 111 { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, |
115 { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX }, | 112 { "createProfileShortcutCheckbox", IDS_PROFILES_CREATE_SHORTCUT_CHECKBOX }, |
116 { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON }, | 113 { "createProfileShortcutButton", IDS_PROFILES_CREATE_SHORTCUT_BUTTON }, |
117 { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON }, | 114 { "removeProfileShortcutButton", IDS_PROFILES_REMOVE_SHORTCUT_BUTTON }, |
118 { "importExistingManagedUserLink", | 115 { "importExistingManagedUserLink", |
119 IDS_PROFILES_IMPORT_EXISTING_MANAGED_USER_LINK }, | 116 IDS_PROFILES_IMPORT_EXISTING_MANAGED_USER_LINK }, |
120 { "signInToImportManagedUsers", | 117 { "signInToImportManagedUsers", |
121 IDS_PROFILES_IMPORT_MANAGED_USER_NOT_SIGNED_IN }, | 118 IDS_PROFILES_IMPORT_MANAGED_USER_NOT_SIGNED_IN }, |
122 }; | 119 }; |
123 | 120 |
124 RegisterStrings(localized_strings, resources, arraysize(resources)); | 121 RegisterStrings(localized_strings, resources, arraysize(resources)); |
125 RegisterTitle(localized_strings, "manageProfile", | 122 RegisterTitle(localized_strings, "manageProfile", |
126 IDS_PROFILES_MANAGE_TITLE); | 123 IDS_PROFILES_MANAGE_TITLE); |
127 RegisterTitle(localized_strings, "createProfile", | 124 RegisterTitle(localized_strings, "createProfile", |
128 IDS_PROFILES_CREATE_TITLE); | 125 IDS_PROFILES_CREATE_TITLE); |
129 | 126 |
130 localized_strings->SetBoolean("profileShortcutsEnabled", | 127 localized_strings->SetBoolean("profileShortcutsEnabled", |
131 ProfileShortcutManager::IsFeatureEnabled()); | 128 ProfileShortcutManager::IsFeatureEnabled()); |
132 | 129 |
133 localized_strings->SetString("enterpriseManagedAccountHelpURL", | 130 localized_strings->SetString( |
134 chrome::kEnterpriseManagedAccountHelpURL); | 131 "disconnectManagedProfileText", |
132 l10n_util::GetStringFUTF16( | |
133 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT, | |
134 base::UTF8ToUTF16(chrome::kSyncGoogleDashboardURL))); | |
135 | |
136 Profile* profile = Profile::FromWebUI(web_ui()); | |
137 std::string domain_name = "unknown"; | |
Andrew T Wilson (Slow)
2014/04/24 15:46:17
Either leave this blank (no default domain name) o
kaliamoorthi
2014/04/24 21:42:15
I have removed the default.
| |
138 if (profile && !profile->GetProfileName().empty()) | |
Andrew T Wilson (Slow)
2014/04/24 15:46:17
Is "profile->GetProfileName()" really what you wan
kaliamoorthi
2014/04/24 21:42:15
Done.
| |
139 domain_name = gaia::ExtractDomainName(profile->GetProfileName()); | |
140 | |
141 // If there is no one logged in or if the profile name is empty then the | |
142 // domain name is unknown. This happens in browser tests. | |
143 localized_strings->SetString( | |
144 "disconnectManagedProfileDomainInformation", | |
145 l10n_util::GetStringFUTF16( | |
146 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_DOMAIN_INFORMATION, | |
147 base::ASCIIToUTF16("<b>" + domain_name + "</b>"))); | |
Andrew T Wilson (Slow)
2014/04/24 15:46:17
I'm OK with this, but I wonder if instead the <b>
Patrick Dubroy
2014/04/24 16:20:11
I don't think it should be part of the localized s
kaliamoorthi
2014/04/24 21:42:15
I chose Patrick's solution for this one. The reaso
kaliamoorthi
2014/04/24 21:42:15
Done.
| |
135 } | 148 } |
136 | 149 |
137 void ManageProfileHandler::InitializeHandler() { | 150 void ManageProfileHandler::InitializeHandler() { |
138 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, | 151 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
139 content::NotificationService::AllSources()); | 152 content::NotificationService::AllSources()); |
140 | 153 |
141 Profile* profile = Profile::FromWebUI(web_ui()); | 154 Profile* profile = Profile::FromWebUI(web_ui()); |
142 pref_change_registrar_.Init(profile->GetPrefs()); | 155 pref_change_registrar_.Init(profile->GetPrefs()); |
143 pref_change_registrar_.Add( | 156 pref_change_registrar_.Add( |
144 prefs::kManagedUserCreationAllowed, | 157 prefs::kManagedUserCreationAllowed, |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 g_browser_process->profile_manager()->profile_shortcut_manager(); | 492 g_browser_process->profile_manager()->profile_shortcut_manager(); |
480 DCHECK(shortcut_manager); | 493 DCHECK(shortcut_manager); |
481 | 494 |
482 shortcut_manager->RemoveProfileShortcuts(profile_file_path); | 495 shortcut_manager->RemoveProfileShortcuts(profile_file_path); |
483 | 496 |
484 // Update the UI buttons. | 497 // Update the UI buttons. |
485 OnHasProfileShortcuts(false); | 498 OnHasProfileShortcuts(false); |
486 } | 499 } |
487 | 500 |
488 } // namespace options | 501 } // namespace options |
OLD | NEW |