Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 410683008: Remove kAppsGalleryInstallAutoConfirmForTests switch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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),
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.h ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698