#include <string>
-#include "chrome/browser/extensions/bundle_installer.h"
+#include "chrome/browser/extensions/active_install_data.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "chrome/browser/extensions/webstore_installer.h"
-#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/common/extensions/api/webstore_private.h"
-#include "components/signin/core/browser/signin_tracker.h"
+#include "chrome/common/extensions/webstore_install_result.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "third_party/skia/include/core/SkBitmap.h"
class ProfileSyncService;
-class SigninManagerBase;
namespace content {
class GpuDataManager;
Profile* profile, const std::string& extension_id);
};
-class WebstorePrivateInstallBundleFunction
- : public ChromeAsyncExtensionFunction,
- public extensions::BundleInstaller::Delegate {
- public:
- DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle",
- WEBSTOREPRIVATE_INSTALLBUNDLE)
-
- WebstorePrivateInstallBundleFunction();
-
- // BundleInstaller::Delegate:
- virtual void OnBundleInstallApproved() OVERRIDE;
- virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE;
- virtual void OnBundleInstallCompleted() OVERRIDE;
-
- protected:
- virtual ~WebstorePrivateInstallBundleFunction();
-
- // ExtensionFunction:
- virtual bool RunAsync() OVERRIDE;
-
- // Reads the extension |details| into |items|.
- bool ReadBundleInfo(
- const api::webstore_private::InstallBundle::Params& details,
- extensions::BundleInstaller::ItemList* items);
-
- private:
- scoped_refptr<extensions::BundleInstaller> bundle_;
-};
-
class WebstorePrivateBeginInstallWithManifest3Function
: public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate,
- public WebstoreInstallHelper::Delegate,
- public SigninTracker::Observer {
+ public WebstoreInstallHelper::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3",
WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3)
// Invalid icon url.
INVALID_ICON_URL,
- // Signin has failed.
- SIGNIN_FAILED,
-
// An extension with the same extension id has already been installed.
ALREADY_INSTALLED,
};
WebstorePrivateBeginInstallWithManifest3Function();
// WebstoreInstallHelper::Delegate:
- virtual void OnWebstoreParseSuccess(
- const std::string& id,
- const SkBitmap& icon,
- base::DictionaryValue* parsed_manifest) OVERRIDE;
- virtual void OnWebstoreParseFailure(
- const std::string& id,
- InstallHelperResultCode result_code,
- const std::string& error_message) OVERRIDE;
+ void OnWebstoreParseSuccess(const std::string& id,
+ const SkBitmap& icon,
+ base::DictionaryValue* parsed_manifest) override;
+ void OnWebstoreParseFailure(const std::string& id,
+ InstallHelperResultCode result_code,
+ const std::string& error_message) override;
// ExtensionInstallPrompt::Delegate:
- virtual void InstallUIProceed() OVERRIDE;
- virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
+ void InstallUIProceed() override;
+ void InstallUIAbort(bool user_initiated) override;
protected:
- virtual ~WebstorePrivateBeginInstallWithManifest3Function();
+ ~WebstorePrivateBeginInstallWithManifest3Function() override;
// ExtensionFunction:
- virtual bool RunAsync() OVERRIDE;
+ bool RunAsync() override;
// Sets the result_ as a string based on |code|.
void SetResultCode(ResultCode code);
private:
- // SigninTracker::Observer override.
- virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
- virtual void SigninSuccess() OVERRIDE;
- virtual void MergeSessionComplete(
- const GoogleServiceAuthError& error) OVERRIDE;
-
- // Called when signin is complete or not needed.
- void SigninCompletedOrNotNeeded();
-
const char* ResultCodeToString(ResultCode code);
// These store the input parameters to the function.
// The class that displays the install prompt.
scoped_ptr<ExtensionInstallPrompt> install_prompt_;
- scoped_ptr<SigninTracker> signin_tracker_;
+ scoped_ptr<ScopedActiveInstall> scoped_active_install_;
// The authuser query parameter value which should be used with CRX download
// requests. This is empty if authuser should not be set on download requests.
WebstorePrivateCompleteInstallFunction();
// WebstoreInstaller::Delegate:
- virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;
- virtual void OnExtensionInstallFailure(
+ void OnExtensionInstallSuccess(const std::string& id) override;
+ void OnExtensionInstallFailure(
const std::string& id,
const std::string& error,
- WebstoreInstaller::FailureReason reason) OVERRIDE;
+ WebstoreInstaller::FailureReason reason) override;
protected:
- virtual ~WebstorePrivateCompleteInstallFunction();
+ ~WebstorePrivateCompleteInstallFunction() override;
// ExtensionFunction:
- virtual bool RunAsync() OVERRIDE;
+ bool RunAsync() override;
private:
scoped_ptr<WebstoreInstaller::Approval> approval_;
+ scoped_ptr<ScopedActiveInstall> scoped_active_install_;
+
+ void OnInstallSuccess(const std::string& id);
};
class WebstorePrivateEnableAppLauncherFunction
WebstorePrivateEnableAppLauncherFunction();
protected:
- virtual ~WebstorePrivateEnableAppLauncherFunction();
+ ~WebstorePrivateEnableAppLauncherFunction() override;
// ExtensionFunction:
- virtual bool RunSync() OVERRIDE;
+ bool RunSync() override;
};
class WebstorePrivateGetBrowserLoginFunction
WEBSTOREPRIVATE_GETBROWSERLOGIN)
protected:
- virtual ~WebstorePrivateGetBrowserLoginFunction() {}
+ ~WebstorePrivateGetBrowserLoginFunction() override {}
// ExtensionFunction:
- virtual bool RunSync() OVERRIDE;
+ bool RunSync() override;
};
class WebstorePrivateGetStoreLoginFunction
WEBSTOREPRIVATE_GETSTORELOGIN)
protected:
- virtual ~WebstorePrivateGetStoreLoginFunction() {}
+ ~WebstorePrivateGetStoreLoginFunction() override {}
// ExtensionFunction:
- virtual bool RunSync() OVERRIDE;
+ bool RunSync() override;
};
class WebstorePrivateSetStoreLoginFunction
WEBSTOREPRIVATE_SETSTORELOGIN)
protected:
- virtual ~WebstorePrivateSetStoreLoginFunction() {}
+ ~WebstorePrivateSetStoreLoginFunction() override {}
// ExtensionFunction:
- virtual bool RunSync() OVERRIDE;
+ bool RunSync() override;
};
class WebstorePrivateGetWebGLStatusFunction
WebstorePrivateGetWebGLStatusFunction();
protected:
- virtual ~WebstorePrivateGetWebGLStatusFunction();
+ ~WebstorePrivateGetWebGLStatusFunction() override;
void OnFeatureCheck(bool feature_allowed);
// ExtensionFunction:
- virtual bool RunAsync() OVERRIDE;
+ bool RunAsync() override;
private:
void CreateResult(bool webgl_allowed);
WebstorePrivateGetIsLauncherEnabledFunction() {}
protected:
- virtual ~WebstorePrivateGetIsLauncherEnabledFunction() {}
+ ~WebstorePrivateGetIsLauncherEnabledFunction() override {}
// ExtensionFunction:
- virtual bool RunSync() OVERRIDE;
+ bool RunSync() override;
private:
void OnIsLauncherCheckCompleted(bool is_enabled);
WebstorePrivateIsInIncognitoModeFunction() {}
protected:
- virtual ~WebstorePrivateIsInIncognitoModeFunction() {}
+ ~WebstorePrivateIsInIncognitoModeFunction() override {}
// ExtensionFunction:
- virtual bool RunSync() OVERRIDE;
+ bool RunSync() override;
};
-class WebstorePrivateSignInFunction : public ChromeAsyncExtensionFunction,
- public SigninManagerFactory::Observer,
- public SigninTracker::Observer {
+class WebstorePrivateLaunchEphemeralAppFunction
+ : public ChromeAsyncExtensionFunction {
public:
- DECLARE_EXTENSION_FUNCTION("webstorePrivate.signIn",
- WEBSTOREPRIVATE_SIGNINFUNCTION)
+ DECLARE_EXTENSION_FUNCTION("webstorePrivate.launchEphemeralApp",
+ WEBSTOREPRIVATE_LAUNCHEPHEMERALAPP)
- WebstorePrivateSignInFunction();
+ WebstorePrivateLaunchEphemeralAppFunction();
protected:
- virtual ~WebstorePrivateSignInFunction();
+ ~WebstorePrivateLaunchEphemeralAppFunction() override;
// ExtensionFunction:
- virtual bool RunAsync() OVERRIDE;
+ bool RunAsync() override;
+
+ private:
+ void OnLaunchComplete(webstore_install::Result result,
+ const std::string& error);
+ void SetResult(
+ api::webstore_private::LaunchEphemeralApp::Results::Result result,
+ const std::string& error);
+};
- // SigninManagerFactory::Observer:
- virtual void SigninManagerShutdown(SigninManagerBase* manager) OVERRIDE;
+class WebstorePrivateGetEphemeralAppsEnabledFunction
+ : public ChromeSyncExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("webstorePrivate.getEphemeralAppsEnabled",
+ WEBSTOREPRIVATE_GETEPHEMERALAPPSENABLED)
- // SigninTracker::Observer:
- virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
- virtual void SigninSuccess() OVERRIDE;
- virtual void MergeSessionComplete(const GoogleServiceAuthError& error)
- OVERRIDE;
+ WebstorePrivateGetEphemeralAppsEnabledFunction();
- private:
- // The sign-in manager for the invoking tab's Chrome Profile. Weak reference.
- SigninManagerBase* signin_manager_;
+ protected:
+ ~WebstorePrivateGetEphemeralAppsEnabledFunction() override;
- // Tracks changes to sign-in state. Used to notify the page when an existing
- // in-progress sign-in completes, either with success or failure.
- scoped_ptr<SigninTracker> signin_tracker_;
+ // ExtensionFunction:
+ bool RunSync() override;
};
} // namespace extensions