| Index: chrome/browser/extensions/extension_install_dialog.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/extension_install_dialog.cc (revision 110267)
|
| +++ chrome/browser/extensions/extension_install_dialog.cc (working copy)
|
| @@ -4,16 +4,12 @@
|
|
|
| #include "chrome/browser/extensions/extension_install_dialog.h"
|
|
|
| -#include "base/bind.h"
|
| #include "base/file_path.h"
|
| -#include "base/message_loop.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/values.h"
|
| #include "chrome/common/extensions/extension.h"
|
|
|
| -namespace {
|
| -
|
| -// A flag used for SetExtensionInstallDialogAutoConfirmForTests
|
| +// A flag used for SetExtensionInstallDialogForManifestAutoConfirmForTests
|
| enum AutoConfirmForTest {
|
| DO_NOT_SKIP = 0,
|
| PROCEED,
|
| @@ -21,37 +17,6 @@
|
| };
|
| AutoConfirmForTest auto_confirm_for_tests = DO_NOT_SKIP;
|
|
|
| -void AutoConfirmTask(ExtensionInstallUI::Delegate* delegate, bool proceed) {
|
| - if (proceed)
|
| - delegate->InstallUIProceed();
|
| - else
|
| - delegate->InstallUIAbort(true);
|
| -}
|
| -
|
| -void DoAutoConfirm(ExtensionInstallUI::Delegate* delegate) {
|
| - bool proceed = (auto_confirm_for_tests == PROCEED);
|
| - // 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.
|
| - MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&AutoConfirmTask, delegate, proceed));
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| -void ShowExtensionInstallDialog(Profile* profile,
|
| - ExtensionInstallUI::Delegate* delegate,
|
| - const Extension* extension,
|
| - SkBitmap* icon,
|
| - const ExtensionInstallUI::Prompt& prompt) {
|
| - if (auto_confirm_for_tests != DO_NOT_SKIP) {
|
| - DoAutoConfirm(delegate);
|
| - return;
|
| - }
|
| - ShowExtensionInstallDialogImpl(profile, delegate, extension, icon, prompt);
|
| -}
|
| -
|
| bool ShowExtensionInstallDialogForManifest(
|
| Profile *profile,
|
| ExtensionInstallUI::Delegate* delegate,
|
| @@ -94,7 +59,10 @@
|
| // In tests, we may have setup to proceed or abort without putting up the real
|
| // confirmation dialog.
|
| if (auto_confirm_for_tests != DO_NOT_SKIP) {
|
| - DoAutoConfirm(delegate);
|
| + if (auto_confirm_for_tests == PROCEED)
|
| + delegate->InstallUIProceed();
|
| + else
|
| + delegate->InstallUIAbort(true);
|
| return true;
|
| }
|
|
|
| @@ -110,7 +78,7 @@
|
| return true;
|
| }
|
|
|
| -void SetExtensionInstallDialogAutoConfirmForTests(
|
| +void SetExtensionInstallDialogForManifestAutoConfirmForTests(
|
| bool should_proceed) {
|
| auto_confirm_for_tests = should_proceed ? PROCEED : ABORT;
|
| }
|
|
|