OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // the normal requirement that it is called during a user gesture. | 77 // the normal requirement that it is called during a user gesture. |
78 static void SetIgnoreUserGestureForTests(bool ignore); | 78 static void SetIgnoreUserGestureForTests(bool ignore); |
79 | 79 |
80 // For use only in tests - sets a flag that makes invocations of | 80 // For use only in tests - sets a flag that makes invocations of |
81 // beginInstallWithManifest skip putting up a real dialog, and instead act | 81 // beginInstallWithManifest skip putting up a real dialog, and instead act |
82 // as if the dialog choice was to proceed or abort. | 82 // as if the dialog choice was to proceed or abort. |
83 static void SetAutoConfirmForTests(bool should_proceed); | 83 static void SetAutoConfirmForTests(bool should_proceed); |
84 | 84 |
85 // Called when we've successfully parsed the manifest and icon data in the | 85 // Called when we've successfully parsed the manifest and icon data in the |
86 // utility process. Ownership of parsed_manifest is transferred. | 86 // utility process. Ownership of parsed_manifest is transferred. |
87 void OnParseSuccess(const SkBitmap& icon, DictionaryValue* parsed_manifest); | 87 void OnParseSuccess(const SkBitmap& icon, |
| 88 base::DictionaryValue* parsed_manifest); |
88 | 89 |
89 // Called to indicate a parse failure. The |result_code| parameter should | 90 // Called to indicate a parse failure. The |result_code| parameter should |
90 // indicate whether the problem was with the manifest or icon data. | 91 // indicate whether the problem was with the manifest or icon data. |
91 void OnParseFailure(ResultCode result_code, const std::string& error_message); | 92 void OnParseFailure(ResultCode result_code, const std::string& error_message); |
92 | 93 |
93 // Implementing ExtensionInstallUI::Delegate interface. | 94 // Implementing ExtensionInstallUI::Delegate interface. |
94 virtual void InstallUIProceed() OVERRIDE; | 95 virtual void InstallUIProceed() OVERRIDE; |
95 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 96 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
96 | 97 |
97 protected: | 98 protected: |
98 virtual ~BeginInstallWithManifestFunction(); | 99 virtual ~BeginInstallWithManifestFunction(); |
99 virtual bool RunImpl(); | 100 virtual bool RunImpl(); |
100 | 101 |
101 // Sets the result_ as a string based on |code|. | 102 // Sets the result_ as a string based on |code|. |
102 void SetResult(ResultCode code); | 103 void SetResult(ResultCode code); |
103 | 104 |
104 private: | 105 private: |
105 // These store the input parameters to the function. | 106 // These store the input parameters to the function. |
106 std::string id_; | 107 std::string id_; |
107 std::string manifest_; | 108 std::string manifest_; |
108 std::string icon_data_; | 109 std::string icon_data_; |
109 std::string localized_name_; | 110 std::string localized_name_; |
110 | 111 |
111 // The results of parsing manifest_ and icon_data_ go into these two. | 112 // The results of parsing manifest_ and icon_data_ go into these two. |
112 scoped_ptr<DictionaryValue> parsed_manifest_; | 113 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
113 SkBitmap icon_; | 114 SkBitmap icon_; |
114 | 115 |
115 // A dummy Extension object we create for the purposes of using | 116 // A dummy Extension object we create for the purposes of using |
116 // ExtensionInstallUI to prompt for confirmation of the install. | 117 // ExtensionInstallUI to prompt for confirmation of the install. |
117 scoped_refptr<Extension> dummy_extension_; | 118 scoped_refptr<Extension> dummy_extension_; |
118 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest2"); | 119 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest2"); |
119 }; | 120 }; |
120 | 121 |
121 class CompleteInstallFunction : public SyncExtensionFunction { | 122 class CompleteInstallFunction : public SyncExtensionFunction { |
122 virtual bool RunImpl(); | 123 virtual bool RunImpl(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Are we waiting for a token available notification? | 164 // Are we waiting for a token available notification? |
164 bool waiting_for_token_; | 165 bool waiting_for_token_; |
165 | 166 |
166 // Used for listening for TokenService notifications. | 167 // Used for listening for TokenService notifications. |
167 NotificationRegistrar registrar_; | 168 NotificationRegistrar registrar_; |
168 | 169 |
169 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.promptBrowserLogin"); | 170 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.promptBrowserLogin"); |
170 }; | 171 }; |
171 | 172 |
172 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ | 173 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ |
OLD | NEW |