diff options
Diffstat (limited to 'chrome/browser/ui/webui/options')
3 files changed, 23 insertions, 6 deletions
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc index 61e1e4d..a2ece94 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc @@ -185,6 +185,10 @@ void ManageProfileHandler::RegisterMessages() { web_ui()->RegisterMessageCallback("refreshGaiaPicture", base::Bind(&ManageProfileHandler::RefreshGaiaPicture, base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "showDisconnectManagedProfileDialog", + base::Bind(&ManageProfileHandler::ShowDisconnectManagedProfileDialog, + base::Unretained(this))); } void ManageProfileHandler::Uninitialize() { @@ -313,6 +317,14 @@ void ManageProfileHandler::SendExistingProfileNames() { "ManageProfileOverlay.receiveExistingProfileNames", profile_name_dict); } +void ManageProfileHandler::ShowDisconnectManagedProfileDialog( + const base::ListValue* args) { + base::DictionaryValue replacements; + GenerateSignedinUserSpecificStrings(&replacements); + web_ui()->CallJavascriptFunction( + "ManageProfileOverlay.showDisconnectManagedProfileDialog", replacements); +} + void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) { DCHECK(args); @@ -468,10 +480,6 @@ void ManageProfileHandler::RequestCreateProfileUpdate( base::StringValue(username), base::FundamentalValue(has_error)); - base::DictionaryValue replacements; - GenerateSignedinUserSpecificStrings(&replacements); - web_ui()->CallJavascriptFunction("loadTimeData.overrideValues", replacements); - OnCreateSupervisedUserPrefChange(); } diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.h b/chrome/browser/ui/webui/options/manage_profile_handler.h index d004ec7..36f8cf5 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.h +++ b/chrome/browser/ui/webui/options/manage_profile_handler.h @@ -72,6 +72,10 @@ class ManageProfileHandler : public OptionsPageUIHandler, // This is used to detect duplicate profile names. void SendExistingProfileNames(); + // Show disconnect managed profile dialog after generating domain and user + // specific strings. + void ShowDisconnectManagedProfileDialog(const base::ListValue* args); + // Callback for the "setProfileIconAndName" message. Sets the name and icon // of a given profile. // |args| is of the form: [ diff --git a/chrome/browser/ui/webui/options/options_ui_browsertest.cc b/chrome/browser/ui/webui/options/options_ui_browsertest.cc index 5d8a70a..7ee21db 100644 --- a/chrome/browser/ui/webui/options/options_ui_browsertest.cc +++ b/chrome/browser/ui/webui/options/options_ui_browsertest.cc @@ -202,8 +202,13 @@ IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, MAYBE_VerifyManagedSignout) { 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);", + "var original = ManageProfileOverlay.showDisconnectManagedProfileDialog;" + "var teststub = function(event) {" + " original(event);" + " domAutomationController.send(original_status && !dialog.hidden);" + "};" + "ManageProfileOverlay.showDisconnectManagedProfileDialog = teststub;" + "$('start-stop-sync').click();", &result)); EXPECT_TRUE(result); |