diff options
author | kaliamoorthi@chromium.org <kaliamoorthi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-28 07:40:02 +0000 |
---|---|---|
committer | kaliamoorthi@chromium.org <kaliamoorthi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-28 07:40:02 +0000 |
commit | 66068e6e4f67447d7e901d353330066c4c6bfb37 (patch) | |
tree | 6417ad0eaf420d28b3553e38ee9b1a4b20f5d972 | |
parent | 2e0de8354f49cb092754b4da19242f6587371629 (diff) | |
download | chromium_src-66068e6e4f67447d7e901d353330066c4c6bfb37.zip chromium_src-66068e6e4f67447d7e901d353330066c4c6bfb37.tar.gz chromium_src-66068e6e4f67447d7e901d353330066c4c6bfb37.tar.bz2 |
Updates the UI and reenables the fix introduced in commit 256939
This CL reenables the change introduced in http://crrev.com/256939. The UI is updated to reflect the one approved by UX team.
BUG=314621
Review URL: https://codereview.chromium.org/225523004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266474 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/chromium_strings.grd | 8 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 10 | ||||
-rw-r--r-- | chrome/app/google_chrome_strings.grd | 8 | ||||
-rw-r--r-- | chrome/browser/resources/options/browser_options.js | 3 | ||||
-rw-r--r-- | chrome/browser/resources/options/manage_profile_overlay.css | 13 | ||||
-rw-r--r-- | chrome/browser/resources/options/manage_profile_overlay.html | 16 | ||||
-rw-r--r-- | chrome/browser/resources/options/manage_profile_overlay.js | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/manage_profile_handler.cc | 48 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/manage_profile_handler.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/options_ui_browsertest.cc | 64 | ||||
-rw-r--r-- | chrome/common/url_constants.cc | 3 | ||||
-rw-r--r-- | chrome/common/url_constants.h | 4 |
12 files changed, 144 insertions, 40 deletions
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index fad4842..23ee8fc 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd @@ -211,14 +211,8 @@ be available for now. --> </translations> <release seq="1" allow_pseudo="false"> <messages fallback_to_english="true"> - <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE" desc="Title of the disconnect managed profile dialog."> - Delete managed Chromium user - </message> <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT" desc="Message explaining to the user what will happen if they disconnect the managed profile."> - You are signed in with a managed account which is controlled by an administrator. If you disconnect from this account, this Chromium user and all associated Chromium data, such as apps, bookmarks, history, passwords, and other settings will be removed from this computer. - </message> - <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL" desc="The text to display on the button to confirm deleting the Chromium user profile."> - Delete Chromium user + Disconnecting <ph name="USERNAME">$1<ex>someone@example.com</ex></ph> will clear your history, bookmarks, settings, and other Chromium data stored on this device. Data stored in your Google Account will not be cleared and can be managed on <ph name="GOOGLE_DASHBOARD_LINK"><a target="_blank" href="$2"></ph>Google Dashboard<ph name="END_GOOGLE_DASHBOARD_LINK"></a></ph>. </message> <message name="IDS_PRODUCT_NAME" desc="The Chrome application name"> Chromium diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index bddbda5..9b3d791b 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -13566,8 +13566,14 @@ Some features may be unavailable. Please check that the profile exists and you <message name="IDS_PROFILES_DELETE_MANAGED_ADDENDUM" desc="Additional message shown in the same dialog following the IDS_PROFILES_DELETE_MESSAGE, explaining to the user what will happen if they delete the profile of a supervised user."> Settings and browsing history for this supervised user may still be visible by the manager at <ph name="BEGIN_LINK"><a target="_blank" href="https://www.chrome.com/manage"></ph>www.chrome.com/manage<ph name="END_LINK"></a><ex></a></ex></ph>. </message> - <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_LEARN_MORE" desc="Learn more link that provides more information on managed accounts."> - Learn more + <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE" desc="Title of the disconnect managed profile dialog."> + Disconnect your Google Account + </message> + <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_DOMAIN_INFORMATION" desc="The text that provides the domain information."> + This account is managed by <ph name="DOMAIN">$1<ex>example.com</ex></ph> + </message> + <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL" desc="The text to display on the button that clears the data and disconnect user account."> + Clear data and disconnect </message> <message name="IDS_PROFILES_LIST_ITEM_CURRENT" desc="Text to display in the multi-profiles list when this profile is the current profile"> <ph name="PROFILE_NAME">$1<ex>New User</ex></ph> (current) diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index c80f0d7..2ccc4c2 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd @@ -134,14 +134,8 @@ Chrome supports. --> </translations> <release seq="1" allow_pseudo="false"> <messages fallback_to_english="true"> - <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE" desc="Title of the disconnect managed profile dialog."> - Delete managed Chrome user - </message> <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT" desc="Message explaining to the user what will happen if they disconnect the managed profile."> - You are signed in with a managed account which is controlled by an administrator. If you disconnect from this account, this Chrome user and all associated Chrome data, such as apps, bookmarks, history, passwords, and other settings will be removed from this computer. - </message> - <message name="IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL" desc="The text to display on the button to confirm deleting the Chrome user profile."> - Delete Chrome user + Disconnecting <ph name="USERNAME">$1<ex>someone@example.com</ex></ph> will clear your history, bookmarks, settings, and other Chrome data stored on this device. Data stored in your Google Account will not be cleared and can be managed on <ph name="GOOGLE_DASHBOARD_LINK"><a target="_blank" href="$2"></ph>Google Dashboard<ph name="END_GOOGLE_DASHBOARD_LINK"></a></ph>. </message> <message name="IDS_PRODUCT_NAME" desc="The Chrome application name"> Google Chrome diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index 361a31c..29fd428 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -872,8 +872,7 @@ cr.define('options', function() { // Disable the "sign in" button if we're currently signing in, or if we're // already signed in and signout is not allowed. var signInButton = $('start-stop-sync'); - signInButton.disabled = syncData.setupInProgress || - !syncData.signoutAllowed; + signInButton.disabled = syncData.setupInProgress; this.signoutAllowed_ = syncData.signoutAllowed; if (!syncData.signoutAllowed) $('start-stop-sync-indicator').setAttribute('controlled-by', 'policy'); diff --git a/chrome/browser/resources/options/manage_profile_overlay.css b/chrome/browser/resources/options/manage_profile_overlay.css index 2ea31e0..4aa53d4 100644 --- a/chrome/browser/resources/options/manage_profile_overlay.css +++ b/chrome/browser/resources/options/manage_profile_overlay.css @@ -37,6 +37,19 @@ background-color: pink; } +#disconnect-managed-profile-domain-name { + font-weight: bold; +} + +#disconnect-managed-profile-domain-information { + background-color: #f0f0f0; + padding: 14px 0 14px 17px; +} + +#disconnect-managed-profile-message { + padding-top: 9px; +} + #create-profile-error-bubble, #manage-profile-error-bubble { -webkit-transition: max-height 200ms, padding 200ms; diff --git a/chrome/browser/resources/options/manage_profile_overlay.html b/chrome/browser/resources/options/manage_profile_overlay.html index 14e6fa8..c2a610d 100644 --- a/chrome/browser/resources/options/manage_profile_overlay.html +++ b/chrome/browser/resources/options/manage_profile_overlay.html @@ -55,25 +55,23 @@ <!-- Dialog for disconnecting enterprise managed profiles. --> <div id="manage-profile-overlay-disconnect-managed" hidden> <h1 i18n-content="disconnectManagedProfileTitle"></h1> + <div class="content-area" + id="disconnect-managed-profile-domain-information" + i18n-values=".innerHTML:disconnectManagedProfileDomainInformation"> + </div> <div class="content-area"> <div id="disconnect-managed-profile-message"> <div id="disconnect-managed-profile-text" - i18n-content="disconnectManagedProfileText"> + i18n-values=".innerHTML:disconnectManagedProfileText"> </div> </div> </div> <div class="action-area"> - <div class="action-area-shortcut-container"> - <a id="disconnect-managed-profile-learn-more" class="reset-hidden" - i18n-content="disconnectManagedProfileLearnMore" target="_blank" - i18n-values="href:enterpriseManagedAccountHelpURL"> - </a> - </div> <div class="button-strip"> - <button id="disconnect-managed-profile-cancel" - i18n-content="cancel"></button> <button id="disconnect-managed-profile-ok" class="default-button" i18n-content="disconnectManagedProfileOK"></button> + <button id="disconnect-managed-profile-cancel" + i18n-content="cancel"></button> </div> </div> </div> diff --git a/chrome/browser/resources/options/manage_profile_overlay.js b/chrome/browser/resources/options/manage_profile_overlay.js index 1533fb5..aa51a83 100644 --- a/chrome/browser/resources/options/manage_profile_overlay.js +++ b/chrome/browser/resources/options/manage_profile_overlay.js @@ -554,6 +554,10 @@ cr.define('options', function() { $('manage-profile-overlay-create').hidden = true; $('manage-profile-overlay-manage').hidden = true; $('manage-profile-overlay-delete').hidden = true; + $('disconnect-managed-profile-domain-information').innerHTML = + loadTimeData.getString('disconnectManagedProfileDomainInformation'); + $('disconnect-managed-profile-text').innerHTML = + loadTimeData.getString('disconnectManagedProfileText'); $('manage-profile-overlay-disconnect-managed').hidden = false; // Because this dialog isn't useful when refreshing or as part of the diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc index 40cef2f..bc8c2d6 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc @@ -35,6 +35,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_ui.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "grit/generated_resources.h" #include "grit/google_chrome_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -105,10 +106,6 @@ void ManageProfileHandler::GetLocalizedValues( IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TITLE }, { "disconnectManagedProfileOK", IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_OK_BUTTON_LABEL }, - { "disconnectManagedProfileText", - IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT }, - { "disconnectManagedProfileLearnMore", - IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_LEARN_MORE }, { "createProfileTitle", IDS_PROFILES_CREATE_TITLE }, { "createProfileInstructions", IDS_PROFILES_CREATE_INSTRUCTIONS }, { "createProfileConfirm", IDS_PROFILES_CREATE_CONFIRM }, @@ -130,8 +127,7 @@ void ManageProfileHandler::GetLocalizedValues( localized_strings->SetBoolean("profileShortcutsEnabled", ProfileShortcutManager::IsFeatureEnabled()); - localized_strings->SetString("enterpriseManagedAccountHelpURL", - chrome::kEnterpriseManagedAccountHelpURL); + GenerateSignedinUserSpecificStrings(localized_strings); } void ManageProfileHandler::InitializeHandler() { @@ -207,6 +203,41 @@ void ManageProfileHandler::OnStateChanged() { RequestCreateProfileUpdate(NULL); } +void ManageProfileHandler::GenerateSignedinUserSpecificStrings( + base::DictionaryValue* dictionary) { +#if !defined(OS_CHROMEOS) + Profile* profile = Profile::FromWebUI(web_ui()); + DCHECK(profile); + SigninManagerBase* manager = SigninManagerFactory::GetForProfile(profile); + DCHECK(manager); + std::string username = manager->GetAuthenticatedUsername(); + std::string domain_name; + // If there is no one logged in or if the profile name is empty then the + // domain name is empty. This happens in browser tests. + if (!username.empty()) + domain_name = "<span id=disconnect-managed-profile-domain-name>" + + gaia::ExtractDomainName(username) + "</span>"; + + dictionary->SetString( + "disconnectManagedProfileDomainInformation", + l10n_util::GetStringFUTF16( + IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_DOMAIN_INFORMATION, + base::ASCIIToUTF16(domain_name))); + + dictionary->SetString( + "disconnectManagedProfileText", + l10n_util::GetStringFUTF16( + IDS_PROFILES_DISCONNECT_MANAGED_PROFILE_TEXT, + base::UTF8ToUTF16(username), + base::UTF8ToUTF16(chrome::kSyncGoogleDashboardURL))); +#else + dictionary->SetString("disconnectManagedProfileDomainInformation", + base::string16()); + dictionary->SetString("disconnectManagedProfileText", + base::string16()); +#endif +} + void ManageProfileHandler::RequestDefaultProfileIcons( const base::ListValue* args) { std::string mode; @@ -434,6 +465,11 @@ void ManageProfileHandler::RequestCreateProfileUpdate( web_ui()->CallJavascriptFunction("CreateProfileOverlay.updateSignedInStatus", base::StringValue(username), base::FundamentalValue(has_error)); + + base::DictionaryValue replacements; + GenerateSignedinUserSpecificStrings(&replacements); + web_ui()->CallJavascriptFunction("loadTimeData.overrideValues", replacements); + OnCreateManagedUserPrefChange(); } diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.h b/chrome/browser/ui/webui/options/manage_profile_handler.h index 73aca88..c9801ca 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.h +++ b/chrome/browser/ui/webui/options/manage_profile_handler.h @@ -46,6 +46,9 @@ class ManageProfileHandler : public OptionsPageUIHandler, virtual void OnStateChanged() OVERRIDE; private: + // This function creates signed in user specific strings in loadTimeData. + void GenerateSignedinUserSpecificStrings(base::DictionaryValue* dictionary); + // Callback for the "requestDefaultProfileIcons" message. // Sends the array of default profile icon URLs and profile names to WebUI. // First item of |args| is the dialog mode, i.e. "create" or "manage". diff --git a/chrome/browser/ui/webui/options/options_ui_browsertest.cc b/chrome/browser/ui/webui/options/options_ui_browsertest.cc index 41b3813..0313cc4 100644 --- a/chrome/browser/ui/webui/options/options_ui_browsertest.cc +++ b/chrome/browser/ui/webui/options/options_ui_browsertest.cc @@ -8,6 +8,7 @@ #include "base/scoped_observer.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/chrome_pages.h" @@ -18,6 +19,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "components/signin/core/browser/signin_manager.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" @@ -168,7 +170,69 @@ IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, LoadOptionsByURL) { VerifyNavbar(); } +// Flaky on win_rel when the profile is deleted crbug.com/103355 +// Also related to crbug.com/104851 +#if defined(OS_WIN) +#define MAYBE_VerifyManagedSignout DISABLED_VerifyManagedSignout +#else +#define MAYBE_VerifyManagedSignout VerifyManagedSignout +#endif + #if !defined(OS_CHROMEOS) +IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, MAYBE_VerifyManagedSignout) { + SigninManager* signin = + SigninManagerFactory::GetForProfile(browser()->profile()); + signin->OnExternalSigninCompleted("test@example.com"); + signin->ProhibitSignout(true); + + NavigateToSettingsFrame(); + + // This script simulates a click on the "Disconnect your Google Account" + // button and returns true if the hidden flag of the appropriate dialog gets + // flipped. + bool result = false; + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( + browser()->tab_strip_model()->GetActiveWebContents(), + "var dialog = $('manage-profile-overlay-disconnect-managed');" + "var original_status = dialog.hidden;" + "$('start-stop-sync').click();" + "domAutomationController.send(original_status && !dialog.hidden);", + &result)); + + EXPECT_TRUE(result); + + base::FilePath profile_dir = browser()->profile()->GetPath(); + ProfileInfoCache& profile_info_cache = + g_browser_process->profile_manager()->GetProfileInfoCache(); + + EXPECT_TRUE(DirectoryExists(profile_dir)); + EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) != + std::string::npos); + + content::WindowedNotificationObserver wait_for_profile_deletion( + chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, + content::NotificationService::AllSources()); + + // TODO(kaliamoorthi): Get the macos problem fixed and remove this code. + // Deleting the Profile also destroys all browser windows of that Profile. + // Wait for the current browser to close before resuming, otherwise + // the browser_tests shutdown code will be confused on the Mac. + content::WindowedNotificationObserver wait_for_browser_closed( + chrome::NOTIFICATION_BROWSER_CLOSED, + content::NotificationService::AllSources()); + + ASSERT_TRUE(content::ExecuteScript( + browser()->tab_strip_model()->GetActiveWebContents(), + "$('disconnect-managed-profile-ok').click();")); + + wait_for_profile_deletion.Wait(); + + EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) == + std::string::npos); + + wait_for_browser_closed.Wait(); +} + IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { SigninManager* signin = SigninManagerFactory::GetForProfile(browser()->profile()); diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 1623791..8c7dce3 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -537,9 +537,6 @@ const char kSyncEncryptionHelpURL[] = const char kSyncErrorsHelpURL[] = "https://support.google.com/chrome/?p=settings_sync_error"; -const char kEnterpriseManagedAccountHelpURL[] = - "https://support.google.com/chromebook/answer/1331549"; - #if defined(OS_CHROMEOS) const char kNaturalScrollHelpURL[] = "https://support.google.com/chromeos/?p=simple_scrolling"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 7379724..a153dda 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -455,10 +455,6 @@ extern const char kSyncEncryptionHelpURL[]; // The URL for the "Learn more" link when there is a sync error. extern const char kSyncErrorsHelpURL[]; -// The URL for the "Learn more" link displayed when disconnecting a managed -// profile. -extern const char kEnterpriseManagedAccountHelpURL[]; - #if defined(OS_CHROMEOS) // The URL for the "Learn more" link for natural scrolling on ChromeOS. extern const char kNaturalScrollHelpURL[]; |