| Index: chrome/browser/extensions/extension_install_prompt.cc
|
| diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
|
| index 074b0469582a8b0eeeca7e7cfed6f20f8b0b4ec3..5acd2ae8df7279b0feca3d1492fd2859b7ab174f 100644
|
| --- a/chrome/browser/extensions/extension_install_prompt.cc
|
| +++ b/chrome/browser/extensions/extension_install_prompt.cc
|
| @@ -132,30 +132,25 @@ SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) {
|
| // If auto confirm is enabled then posts a task to proceed with or cancel the
|
| // install and returns true. Otherwise returns false.
|
| bool AutoConfirmPrompt(ExtensionInstallPrompt::Delegate* delegate) {
|
| - const CommandLine* cmdline = CommandLine::ForCurrentProcess();
|
| - if (!cmdline->HasSwitch(switches::kAppsGalleryInstallAutoConfirmForTests))
|
| - return false;
|
| - std::string value = cmdline->GetSwitchValueASCII(
|
| - switches::kAppsGalleryInstallAutoConfirmForTests);
|
| -
|
| - // We use PostTask instead of calling the delegate directly here, because in
|
| - // the real implementations it's highly likely the message loop will be
|
| - // pumping a few times before the user clicks accept or cancel.
|
| - if (value == "accept") {
|
| - base::MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIProceed,
|
| - base::Unretained(delegate)));
|
| - return true;
|
| - }
|
| -
|
| - if (value == "cancel") {
|
| - base::MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIAbort,
|
| - base::Unretained(delegate),
|
| - true));
|
| - return true;
|
| + switch (ExtensionInstallPrompt::g_auto_confirm_for_tests) {
|
| + case ExtensionInstallPrompt::NONE:
|
| + return false;
|
| + // We use PostTask instead of calling the delegate directly here, because in
|
| + // the real implementations it's highly likely the message loop will be
|
| + // pumping a few times before the user clicks accept or cancel.
|
| + case ExtensionInstallPrompt::ACCEPT:
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIProceed,
|
| + base::Unretained(delegate)));
|
| + return true;
|
| + case ExtensionInstallPrompt::CANCEL:
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIAbort,
|
| + base::Unretained(delegate),
|
| + true));
|
| + return true;
|
| }
|
|
|
| NOTREACHED();
|
| @@ -177,6 +172,10 @@ gfx::NativeWindow NativeWindowForWebContents(content::WebContents* contents) {
|
|
|
| } // namespace
|
|
|
| +// static
|
| +ExtensionInstallPrompt::AutoConfirmForTests
|
| +ExtensionInstallPrompt::g_auto_confirm_for_tests = ExtensionInstallPrompt::NONE;
|
| +
|
| ExtensionInstallPrompt::Prompt::Prompt(PromptType type)
|
| : type_(type),
|
| is_showing_details_for_retained_files_(false),
|
|
|