Commit 5081fb2f authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Restrict Print Preview Cloud Print sign-in handler

As users will no longer be presented the promo to sign-in to Cloud
Print, remove dead code by restricting the sign-in handler to adding new
accounts.

Bug: 1113881
Change-Id: I328b83d4914c0654321a0d5efb616b669d405d1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343229
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796647}
parent b08a6943
......@@ -380,7 +380,7 @@ export class NativeLayerImpl {
/** @override */
signIn() {
chrome.send('signIn', [true]);
chrome.send('signIn');
}
// <if expr="chromeos">
......
......@@ -58,12 +58,9 @@ class SignInObserver : public content::WebContentsObserver {
} // namespace
void CreateCloudPrintSigninTab(Browser* browser,
bool add_account,
base::OnceClosure callback) {
void CreateCloudPrintSigninTab(Browser* browser, base::OnceClosure callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL()
: cloud_devices::GetCloudPrintSigninURL();
GURL url = cloud_devices::GetCloudPrintAddAccountURL();
content::WebContents* web_contents = browser->OpenURL(content::OpenURLParams(
google_util::AppendGoogleLocaleParam(
url, g_browser_process->GetApplicationLocale()),
......
......@@ -11,11 +11,8 @@ class Browser;
namespace printing {
// Creates a tab with Google 'sign in' or 'add account' page, based on
// passed |add_account| value.
void CreateCloudPrintSigninTab(Browser* browser,
bool add_account,
base::OnceClosure callback);
// Creates a tab with Google 'add account' page.
void CreateCloudPrintSigninTab(Browser* browser, base::OnceClosure callback);
} // namespace printing
......
......@@ -794,10 +794,7 @@ void PrintPreviewHandler::HandlePrinterSetup(const base::ListValue* args) {
weak_factory_.GetWeakPtr(), callback_id, printer_name));
}
void PrintPreviewHandler::HandleSignin(const base::ListValue* args) {
bool add_account = false;
CHECK(args->GetBoolean(0, &add_account));
void PrintPreviewHandler::HandleSignin(const base::ListValue* /*args*/) {
Profile* profile = Profile::FromWebUI(web_ui());
DCHECK(profile);
......@@ -806,20 +803,15 @@ void PrintPreviewHandler::HandleSignin(const base::ListValue* args) {
// Chrome OS Account Manager is enabled on this Profile and hence, all
// account management flows will go through native UIs and not through a
// tabbed browser window.
if (add_account) {
chromeos::InlineLoginDialogChromeOS::Show(
chromeos::InlineLoginDialogChromeOS::Source::kPrintPreviewDialog);
} else {
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
profile, chromeos::settings::mojom::kMyAccountsSubpagePath);
}
chromeos::InlineLoginDialogChromeOS::Show(
chromeos::InlineLoginDialogChromeOS::Source::kPrintPreviewDialog);
return;
}
#endif
chrome::ScopedTabbedBrowserDisplayer displayer(profile);
CreateCloudPrintSigninTab(
displayer.browser(), add_account,
displayer.browser(),
base::BindOnce(&PrintPreviewHandler::OnSignInTabClosed,
weak_factory_.GetWeakPtr()));
}
......
......@@ -214,8 +214,8 @@ class PrintPreviewHandler : public content::WebUIMessageHandler,
void HandleShowSystemDialog(const base::ListValue* args);
#endif
// Opens a new tab to allow the user to sign into cloud print. |args| holds
// a boolean indicating whether the user is adding an account.
// Opens a new tab to allow the user to add an account to sign into cloud
// print. |args| is unused.
void HandleSignin(const base::ListValue* args);
// Called when the tab opened by HandleSignIn() is closed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment