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

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

Issue 7741037: Add WebstoreInlineInstaller (downloads store data, shows the install UI, and starts the install). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put webstore response in the right directory. Created 9 years, 4 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_dialog.cc
diff --git a/chrome/browser/extensions/extension_install_dialog.cc b/chrome/browser/extensions/extension_install_dialog.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a58e2595c51a385602fbe2807dc5ea89ab9c502a
--- /dev/null
+++ b/chrome/browser/extensions/extension_install_dialog.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_install_dialog.h"
+
+#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "chrome/common/extensions/extension.h"
+
+// A flag used for SetExtensionInstallDialogForManifestAutoConfirmForTests
+enum AutoConfirmForTest {
+ DO_NOT_SKIP = 0,
+ PROCEED,
+ ABORT
+};
+AutoConfirmForTest auto_confirm_for_tests = DO_NOT_SKIP;
+
+void ShowExtensionInstallDialogForManifest(
+ Profile *profile,
+ ExtensionInstallUI::Delegate* delegate,
+ const DictionaryValue* manifest,
+ const std::string& id,
+ const std::string& localized_name,
+ SkBitmap* icon,
+ ExtensionInstallUI::PromptType type,
+ scoped_refptr<Extension>* dummy_extension) {
+ scoped_ptr<DictionaryValue> localized_manifest;
+ if (!localized_name.empty()) {
+ localized_manifest.reset(manifest->DeepCopy());
+ localized_manifest->SetString(extension_manifest_keys::kName,
+ localized_name);
+ }
+
+ std::string init_errors;
+ *dummy_extension = Extension::CreateWithId(
+ FilePath(),
+ Extension::INTERNAL,
+ localized_manifest.get() ? *localized_manifest.get() : *manifest,
+ Extension::NO_FLAGS,
+ id,
+ &init_errors);
+ if (!dummy_extension->get()) {
+ return;
+ }
+
+ if (icon->empty())
+ icon = const_cast<SkBitmap*>(&Extension::GetDefaultIcon(
+ (*dummy_extension)->is_app()));
+
+ // 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) {
+ if (auto_confirm_for_tests == PROCEED)
+ delegate->InstallUIProceed();
+ else
+ delegate->InstallUIAbort(true);
+ return;
+ }
+
+ ShowExtensionInstallDialog(profile,
+ delegate,
+ dummy_extension->get(),
+ icon,
+ (*dummy_extension)->GetPermissionMessageStrings(),
+ ExtensionInstallUI::INSTALL_PROMPT);
+ return;
+}
+
+void SetExtensionInstallDialogForManifestAutoConfirmForTests(
+ bool should_proceed) {
+ auto_confirm_for_tests = should_proceed ? PROCEED : ABORT;
+}
« no previous file with comments | « chrome/browser/extensions/extension_install_dialog.h ('k') | chrome/browser/extensions/extension_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698