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

Side by Side Diff: chrome/browser/ui/webui/options/manage_profile_handler.cc

Issue 225523004: Updates the UI and reenables the fix introduced in commit 256939 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes review comments and some minor changes in the UI Created 6 years, 8 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 unified diff | Download patch
OLDNEW
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
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
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 Profile* profile = Profile::FromWebUI(web_ui());
134 chrome::kEnterpriseManagedAccountHelpURL); 131 DCHECK(profile);
132 SigninManagerBase* manager = SigninManagerFactory::GetForProfile(profile);
133 DCHECK(manager);
134 std::string username = manager->GetAuthenticatedUsername();
135 std::string domain_name = "<span id=disconnect-managed-profile-domain-name>" +
Patrick Dubroy 2014/04/24 23:23:52 Sorry, I should have been more clear -- the string
Andrew T Wilson (Slow) 2014/04/25 11:50:05 How can he do this, given that it's embedded in an
Patrick Dubroy 2014/04/25 16:38:46 My mistake, I didn't look closely enough. In that
136 gaia::ExtractDomainName(username) + "</span>";
137 // If there is no one logged in or if the profile name is empty then the
138 // domain name is unknown. This happens in browser tests.
139 localized_strings->SetString(
140 "disconnectManagedProfileDomainInformation",
141 l10n_util::GetStringFUTF16(
142 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_DOMAIN_INFORMATION,
143 base::ASCIIToUTF16(domain_name)));
144
145 localized_strings->SetString(
146 "disconnectManagedProfileText",
147 l10n_util::GetStringFUTF16(
148 IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT,
149 base::UTF8ToUTF16(username),
150 base::UTF8ToUTF16(chrome::kSyncGoogleDashboardURL)));
135 } 151 }
136 152
137 void ManageProfileHandler::InitializeHandler() { 153 void ManageProfileHandler::InitializeHandler() {
138 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 154 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
139 content::NotificationService::AllSources()); 155 content::NotificationService::AllSources());
140 156
141 Profile* profile = Profile::FromWebUI(web_ui()); 157 Profile* profile = Profile::FromWebUI(web_ui());
142 pref_change_registrar_.Init(profile->GetPrefs()); 158 pref_change_registrar_.Init(profile->GetPrefs());
143 pref_change_registrar_.Add( 159 pref_change_registrar_.Add(
144 prefs::kManagedUserCreationAllowed, 160 prefs::kManagedUserCreationAllowed,
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 g_browser_process->profile_manager()->profile_shortcut_manager(); 495 g_browser_process->profile_manager()->profile_shortcut_manager();
480 DCHECK(shortcut_manager); 496 DCHECK(shortcut_manager);
481 497
482 shortcut_manager->RemoveProfileShortcuts(profile_file_path); 498 shortcut_manager->RemoveProfileShortcuts(profile_file_path);
483 499
484 // Update the UI buttons. 500 // Update the UI buttons.
485 OnHasProfileShortcuts(false); 501 OnHasProfileShortcuts(false);
486 } 502 }
487 503
488 } // namespace options 504 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698