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

Unified Diff: chrome/browser/extensions/api/webstore_private/webstore_private_api.h

Issue 885443010: WebstorePrivate extension API cleanup, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testext_permission_prompt
Patch Set: fix Created 5 years, 10 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/api/webstore_private/webstore_private_api.h
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
index e61cdb0fef8c4bc3f69864e28c3b7670f79fe59c..151bb4705e13fc74ca5d4a60eb0a7d30135274a9 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
@@ -9,6 +9,7 @@
#include "chrome/browser/extensions/active_install_data.h"
#include "chrome/browser/extensions/chrome_extension_function.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/browser/extensions/webstore_installer.h"
@@ -44,7 +45,7 @@ class WebstorePrivateApi {
};
class WebstorePrivateBeginInstallWithManifest3Function
- : public ChromeAsyncExtensionFunction,
+ : public UIThreadExtensionFunction,
public ExtensionInstallPrompt::Delegate,
public WebstoreInstallHelper::Delegate {
public:
@@ -84,6 +85,12 @@ class WebstorePrivateBeginInstallWithManifest3Function
WebstorePrivateBeginInstallWithManifest3Function();
+ private:
+ ~WebstorePrivateBeginInstallWithManifest3Function() override;
+
+ // ExtensionFunction:
+ ExtensionFunction::ResponseAction Run() override;
+
// WebstoreInstallHelper::Delegate:
void OnWebstoreParseSuccess(const std::string& id,
const SkBitmap& icon,
@@ -96,19 +103,21 @@ class WebstorePrivateBeginInstallWithManifest3Function
void InstallUIProceed() override;
void InstallUIAbort(bool user_initiated) override;
- protected:
- ~WebstorePrivateBeginInstallWithManifest3Function() override;
-
- // ExtensionFunction:
- bool RunAsync() override;
+ // Response helpers.
+ const char* ResultCodeToString(ResultCode code) const;
+ ExtensionFunction::ResponseValue BuildResponseForSuccess();
+ ExtensionFunction::ResponseValue BuildResponseForError(
+ ResultCode code, const std::string& error);
- // Sets the result_ as a string based on |code|.
- void SetResultCode(ResultCode code);
+ // Convenience response methods.
+ ExtensionFunction::ResponseAction RespondNowWithError(
+ ResultCode code, const std::string& error);
+ void RespondWithSuccess();
+ void RespondWithError(ResultCode code, const std::string& error);
- private:
- const char* ResultCodeToString(ResultCode code);
+ ChromeExtensionFunctionDetails chrome_details_;
- // These store the input parameters to the function.
+ // This stores the input parameters to the function.
scoped_ptr<api::webstore_private::BeginInstallWithManifest3::Params> params_;
// The results of parsing manifest_ and icon_data_ go into these two.

Powered by Google App Engine
This is Rietveld 408576698