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 { ...@@ -380,7 +380,7 @@ export class NativeLayerImpl {
/** @override */ /** @override */
signIn() { signIn() {
chrome.send('signIn', [true]); chrome.send('signIn');
} }
// <if expr="chromeos"> // <if expr="chromeos">
......
...@@ -58,12 +58,9 @@ class SignInObserver : public content::WebContentsObserver { ...@@ -58,12 +58,9 @@ class SignInObserver : public content::WebContentsObserver {
} // namespace } // namespace
void CreateCloudPrintSigninTab(Browser* browser, void CreateCloudPrintSigninTab(Browser* browser, base::OnceClosure callback) {
bool add_account,
base::OnceClosure callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
GURL url = add_account ? cloud_devices::GetCloudPrintAddAccountURL() GURL url = cloud_devices::GetCloudPrintAddAccountURL();
: cloud_devices::GetCloudPrintSigninURL();
content::WebContents* web_contents = browser->OpenURL(content::OpenURLParams( content::WebContents* web_contents = browser->OpenURL(content::OpenURLParams(
google_util::AppendGoogleLocaleParam( google_util::AppendGoogleLocaleParam(
url, g_browser_process->GetApplicationLocale()), url, g_browser_process->GetApplicationLocale()),
......
...@@ -11,11 +11,8 @@ class Browser; ...@@ -11,11 +11,8 @@ class Browser;
namespace printing { namespace printing {
// Creates a tab with Google 'sign in' or 'add account' page, based on // Creates a tab with Google 'add account' page.
// passed |add_account| value. void CreateCloudPrintSigninTab(Browser* browser, base::OnceClosure callback);
void CreateCloudPrintSigninTab(Browser* browser,
bool add_account,
base::OnceClosure callback);
} // namespace printing } // namespace printing
......
...@@ -794,10 +794,7 @@ void PrintPreviewHandler::HandlePrinterSetup(const base::ListValue* args) { ...@@ -794,10 +794,7 @@ void PrintPreviewHandler::HandlePrinterSetup(const base::ListValue* args) {
weak_factory_.GetWeakPtr(), callback_id, printer_name)); weak_factory_.GetWeakPtr(), callback_id, printer_name));
} }
void PrintPreviewHandler::HandleSignin(const base::ListValue* args) { void PrintPreviewHandler::HandleSignin(const base::ListValue* /*args*/) {
bool add_account = false;
CHECK(args->GetBoolean(0, &add_account));
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
DCHECK(profile); DCHECK(profile);
...@@ -806,20 +803,15 @@ void PrintPreviewHandler::HandleSignin(const base::ListValue* args) { ...@@ -806,20 +803,15 @@ void PrintPreviewHandler::HandleSignin(const base::ListValue* args) {
// Chrome OS Account Manager is enabled on this Profile and hence, all // Chrome OS Account Manager is enabled on this Profile and hence, all
// account management flows will go through native UIs and not through a // account management flows will go through native UIs and not through a
// tabbed browser window. // tabbed browser window.
if (add_account) { chromeos::InlineLoginDialogChromeOS::Show(
chromeos::InlineLoginDialogChromeOS::Show( chromeos::InlineLoginDialogChromeOS::Source::kPrintPreviewDialog);
chromeos::InlineLoginDialogChromeOS::Source::kPrintPreviewDialog);
} else {
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
profile, chromeos::settings::mojom::kMyAccountsSubpagePath);
}
return; return;
} }
#endif #endif
chrome::ScopedTabbedBrowserDisplayer displayer(profile); chrome::ScopedTabbedBrowserDisplayer displayer(profile);
CreateCloudPrintSigninTab( CreateCloudPrintSigninTab(
displayer.browser(), add_account, displayer.browser(),
base::BindOnce(&PrintPreviewHandler::OnSignInTabClosed, base::BindOnce(&PrintPreviewHandler::OnSignInTabClosed,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
} }
......
...@@ -214,8 +214,8 @@ class PrintPreviewHandler : public content::WebUIMessageHandler, ...@@ -214,8 +214,8 @@ class PrintPreviewHandler : public content::WebUIMessageHandler,
void HandleShowSystemDialog(const base::ListValue* args); void HandleShowSystemDialog(const base::ListValue* args);
#endif #endif
// Opens a new tab to allow the user to sign into cloud print. |args| holds // Opens a new tab to allow the user to add an account to sign into cloud
// a boolean indicating whether the user is adding an account. // print. |args| is unused.
void HandleSignin(const base::ListValue* args); void HandleSignin(const base::ListValue* args);
// Called when the tab opened by HandleSignIn() is closed. // 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