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

Unified Diff: chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h

Issue 1268853003: Move webstorePrivate DelegatedInstall functions into new dashboardPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h
diff --git a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..d181966ccfd84ad2f803055496817f35098f9931
--- /dev/null
+++ b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h
@@ -0,0 +1,117 @@
+// Copyright 2015 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
+#define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
+#include "chrome/browser/extensions/bundle_installer.h"
+#include "chrome/browser/extensions/chrome_extension_function_details.h"
+#include "chrome/browser/extensions/extension_install_prompt.h"
+#include "chrome/browser/extensions/webstore_install_helper.h"
+#include "chrome/common/extensions/api/dashboard_private.h"
+#include "extensions/browser/extension_function.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+class GURL;
+
+namespace chrome {
+class BitmapFetcher;
+} // namespace chrome
+
+namespace extensions {
+
+class Extension;
+
+class DashboardPrivateShowPermissionPromptForDelegatedInstallFunction
+ : public UIThreadExtensionFunction,
+ public ExtensionInstallPrompt::Delegate,
+ public WebstoreInstallHelper::Delegate {
+ public:
+ DECLARE_EXTENSION_FUNCTION(
+ "dashboardPrivate.showPermissionPromptForDelegatedInstall",
+ DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL)
+
+ DashboardPrivateShowPermissionPromptForDelegatedInstallFunction();
+
+ private:
+ using Params =
+ api::dashboard_private::ShowPermissionPromptForDelegatedInstall::Params;
+
+ ~DashboardPrivateShowPermissionPromptForDelegatedInstallFunction() override;
+
+ // ExtensionFunction:
+ ExtensionFunction::ResponseAction Run() override;
+
+ // WebstoreInstallHelper::Delegate:
+ void OnWebstoreParseSuccess(const std::string& id,
+ const SkBitmap& icon,
+ base::DictionaryValue* parsed_manifest) override;
+ void OnWebstoreParseFailure(const std::string& id,
+ InstallHelperResultCode result,
+ const std::string& error_message) override;
+
+ // ExtensionInstallPrompt::Delegate:
+ void InstallUIProceed() override;
+ void InstallUIAbort(bool user_initiated) override;
+
+ ExtensionFunction::ResponseValue BuildResponse(
+ api::dashboard_private::Result result,
+ const std::string& error);
+ scoped_ptr<base::ListValue> CreateResults(
+ api::dashboard_private::Result result) const;
+
+ const Params::Details& details() const { return params_->details; }
+
+ scoped_ptr<Params> params_;
+
+ // A dummy Extension object we create for the purposes of using
+ // ExtensionInstallPrompt to prompt for confirmation of the install.
+ scoped_refptr<Extension> dummy_extension_;
+
+ scoped_ptr<ExtensionInstallPrompt> install_prompt_;
+};
+
+class DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction
+ : public UIThreadExtensionFunction,
+ public chrome::BitmapFetcherDelegate {
+ public:
+ DECLARE_EXTENSION_FUNCTION(
+ "dashboardPrivate.showPermissionPromptForDelegatedBundleInstall",
+ DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDBUNDLEINSTALL)
+
+ DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction();
+
+ private:
+ using Params = api::dashboard_private::
+ ShowPermissionPromptForDelegatedBundleInstall::Params;
+
+ ~DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction()
+ override;
+
+ // ExtensionFunction:
+ ExtensionFunction::ResponseAction Run() override;
+
+ // chrome::BitmapFetcherDelegate:
+ void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;
+
+ void OnInstallApproval(BundleInstaller::ApprovalState state);
+
+ const Params::Details& details() const { return params_->details; }
+
+ ChromeExtensionFunctionDetails chrome_details_;
+
+ scoped_ptr<Params> params_;
+
+ scoped_ptr<extensions::BundleInstaller> bundle_;
+ scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
+
« no previous file with comments | « no previous file | chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698