| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/browser_signin.h" | 9 #include "chrome/browser/browser_signin.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "chrome/common/net/gaia/google_service_auth_error.h" | 11 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 12 #include "chrome/common/notification_observer.h" | 12 #include "chrome/common/notification_observer.h" |
| 13 #include "chrome/common/notification_registrar.h" | 13 #include "chrome/common/notification_registrar.h" |
| 14 | 14 |
| 15 class ProfileSyncService; | 15 class ProfileSyncService; |
| 16 | 16 |
| 17 class WebstorePrivateApi { | 17 class WebstorePrivateApi { |
| 18 public: | 18 public: |
| 19 // Allows you to set the ProfileSyncService the function will use for | 19 // Allows you to set the ProfileSyncService the function will use for |
| 20 // testing purposes. | 20 // testing purposes. |
| 21 static void SetTestingProfileSyncService(ProfileSyncService* service); | 21 static void SetTestingProfileSyncService(ProfileSyncService* service); |
| 22 | 22 |
| 23 // Allows you to set the BrowserSignin the function will use for | 23 // Allows you to set the BrowserSignin the function will use for |
| 24 // testing purposes. | 24 // testing purposes. |
| 25 static void SetTestingBrowserSignin(BrowserSignin* signin); | 25 static void SetTestingBrowserSignin(BrowserSignin* signin); |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class InstallFunction : public SyncExtensionFunction { | 28 class BeginInstallFunction : public SyncExtensionFunction { |
| 29 public: | 29 public: |
| 30 // For use only in tests - sets a flag that can cause this function to ignore |
| 31 // the normal requirement that it is called during a user gesture. |
| 32 static void SetIgnoreUserGestureForTests(bool ignore); |
| 33 protected: |
| 34 virtual bool RunImpl(); |
| 35 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstall"); |
| 36 }; |
| 37 |
| 38 class CompleteInstallFunction : public SyncExtensionFunction { |
| 39 public: |
| 40 // This changes the base of the download url to the crx file to be installed. |
| 30 static void SetTestingInstallBaseUrl(const char* testing_install_base_url); | 41 static void SetTestingInstallBaseUrl(const char* testing_install_base_url); |
| 31 | |
| 32 protected: | 42 protected: |
| 33 ~InstallFunction() {} | |
| 34 virtual bool RunImpl(); | 43 virtual bool RunImpl(); |
| 35 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.install"); | 44 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall"); |
| 36 }; | 45 }; |
| 37 | 46 |
| 38 class GetBrowserLoginFunction : public SyncExtensionFunction { | 47 class GetBrowserLoginFunction : public SyncExtensionFunction { |
| 39 virtual bool RunImpl(); | 48 virtual bool RunImpl(); |
| 40 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getBrowserLogin"); | 49 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getBrowserLogin"); |
| 41 }; | 50 }; |
| 42 | 51 |
| 43 class GetStoreLoginFunction : public SyncExtensionFunction { | 52 class GetStoreLoginFunction : public SyncExtensionFunction { |
| 44 virtual bool RunImpl(); | 53 virtual bool RunImpl(); |
| 45 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getStoreLogin"); | 54 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.getStoreLogin"); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 75 // Are we waiting for a token available notification? | 84 // Are we waiting for a token available notification? |
| 76 bool waiting_for_token_; | 85 bool waiting_for_token_; |
| 77 | 86 |
| 78 // Used for listening for TokenService notifications. | 87 // Used for listening for TokenService notifications. |
| 79 NotificationRegistrar registrar_; | 88 NotificationRegistrar registrar_; |
| 80 | 89 |
| 81 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.promptBrowserLogin"); | 90 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.promptBrowserLogin"); |
| 82 }; | 91 }; |
| 83 | 92 |
| 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ | 93 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ |
| OLD | NEW |