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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ICON_ERROR, | 64 ICON_ERROR, |
65 | 65 |
66 // The extension id was invalid. | 66 // The extension id was invalid. |
67 INVALID_ID, | 67 INVALID_ID, |
68 | 68 |
69 // The page does not have permission to call this function. | 69 // The page does not have permission to call this function. |
70 PERMISSION_DENIED, | 70 PERMISSION_DENIED, |
71 | 71 |
72 // The function was not called during a user gesture. | 72 // The function was not called during a user gesture. |
73 NO_GESTURE, | 73 NO_GESTURE, |
| 74 |
| 75 // Invalid icon url. |
| 76 INVALID_ICON_URL |
74 }; | 77 }; |
75 | 78 |
76 // For use only in tests - sets a flag that can cause this function to ignore | 79 // For use only in tests - sets a flag that can cause this function to ignore |
77 // the normal requirement that it is called during a user gesture. | 80 // the normal requirement that it is called during a user gesture. |
78 static void SetIgnoreUserGestureForTests(bool ignore); | 81 static void SetIgnoreUserGestureForTests(bool ignore); |
79 | 82 |
80 // For use only in tests - sets a flag that makes invocations of | 83 // For use only in tests - sets a flag that makes invocations of |
81 // beginInstallWithManifest skip putting up a real dialog, and instead act | 84 // beginInstallWithManifest skip putting up a real dialog, and instead act |
82 // as if the dialog choice was to proceed or abort. | 85 // as if the dialog choice was to proceed or abort. |
83 static void SetAutoConfirmForTests(bool should_proceed); | 86 static void SetAutoConfirmForTests(bool should_proceed); |
84 | 87 |
85 // Called when we've successfully parsed the manifest and icon data in the | 88 // Called when we've successfully parsed the manifest and decoded the icon in |
86 // utility process. Ownership of parsed_manifest is transferred. | 89 // the utility process. Ownership of parsed_manifest is transferred. |
87 void OnParseSuccess(const SkBitmap& icon, | 90 void OnParseSuccess(const SkBitmap& icon, |
88 base::DictionaryValue* parsed_manifest); | 91 base::DictionaryValue* parsed_manifest); |
89 | 92 |
90 // Called to indicate a parse failure. The |result_code| parameter should | 93 // Called to indicate a parse failure. The |result_code| parameter should |
91 // indicate whether the problem was with the manifest or icon data. | 94 // indicate whether the problem was with the manifest or icon. |
92 void OnParseFailure(ResultCode result_code, const std::string& error_message); | 95 void OnParseFailure(ResultCode result_code, const std::string& error_message); |
93 | 96 |
94 // Implementing ExtensionInstallUI::Delegate interface. | 97 // Implementing ExtensionInstallUI::Delegate interface. |
95 virtual void InstallUIProceed() OVERRIDE; | 98 virtual void InstallUIProceed() OVERRIDE; |
96 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 99 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
97 | 100 |
98 protected: | 101 protected: |
99 virtual ~BeginInstallWithManifestFunction(); | 102 virtual ~BeginInstallWithManifestFunction(); |
100 virtual bool RunImpl(); | 103 virtual bool RunImpl(); |
101 | 104 |
102 // Sets the result_ as a string based on |code|. | 105 // Sets the result_ as a string based on |code|. |
103 void SetResult(ResultCode code); | 106 void SetResult(ResultCode code); |
104 | 107 |
105 private: | 108 private: |
106 // These store the input parameters to the function. | 109 // These store the input parameters to the function. |
107 std::string id_; | 110 std::string id_; |
108 std::string manifest_; | 111 std::string manifest_; |
109 std::string icon_data_; | 112 std::string icon_data_; |
110 std::string localized_name_; | 113 std::string localized_name_; |
111 bool use_app_installed_bubble_; | 114 bool use_app_installed_bubble_; |
112 | 115 |
113 // The results of parsing manifest_ and icon_data_ go into these two. | 116 // The results of parsing manifest_ and icon_data_ go into these two. |
114 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 117 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
115 SkBitmap icon_; | 118 SkBitmap icon_; |
116 | 119 |
117 // A dummy Extension object we create for the purposes of using | 120 // A dummy Extension object we create for the purposes of using |
118 // ExtensionInstallUI to prompt for confirmation of the install. | 121 // ExtensionInstallUI to prompt for confirmation of the install. |
119 scoped_refptr<Extension> dummy_extension_; | 122 scoped_refptr<Extension> dummy_extension_; |
| 123 |
120 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest2"); | 124 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest2"); |
121 }; | 125 }; |
122 | 126 |
123 class CompleteInstallFunction : public SyncExtensionFunction { | 127 class CompleteInstallFunction : public SyncExtensionFunction { |
124 virtual bool RunImpl(); | 128 virtual bool RunImpl(); |
125 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall"); | 129 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall"); |
126 }; | 130 }; |
127 | 131 |
128 class GetBrowserLoginFunction : public SyncExtensionFunction { | 132 class GetBrowserLoginFunction : public SyncExtensionFunction { |
129 virtual bool RunImpl(); | 133 virtual bool RunImpl(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Are we waiting for a token available notification? | 169 // Are we waiting for a token available notification? |
166 bool waiting_for_token_; | 170 bool waiting_for_token_; |
167 | 171 |
168 // Used for listening for TokenService notifications. | 172 // Used for listening for TokenService notifications. |
169 NotificationRegistrar registrar_; | 173 NotificationRegistrar registrar_; |
170 | 174 |
171 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.promptBrowserLogin"); | 175 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.promptBrowserLogin"); |
172 }; | 176 }; |
173 | 177 |
174 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ | 178 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBSTORE_PRIVATE_API_H_ |
OLD | NEW |