| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Keys used in JSON representation of extensions. | 31 // Keys used in JSON representation of extensions. |
| 32 static const wchar_t* kContentScriptsKey; | 32 static const wchar_t* kContentScriptsKey; |
| 33 static const wchar_t* kCssKey; | 33 static const wchar_t* kCssKey; |
| 34 static const wchar_t* kDescriptionKey; | 34 static const wchar_t* kDescriptionKey; |
| 35 static const wchar_t* kIdKey; | 35 static const wchar_t* kIdKey; |
| 36 static const wchar_t* kJsKey; | 36 static const wchar_t* kJsKey; |
| 37 static const wchar_t* kMatchesKey; | 37 static const wchar_t* kMatchesKey; |
| 38 static const wchar_t* kNameKey; | 38 static const wchar_t* kNameKey; |
| 39 static const wchar_t* kPermissionsKey; | 39 static const wchar_t* kPermissionsKey; |
| 40 static const wchar_t* kPluginsDirKey; | 40 static const wchar_t* kPluginsDirKey; |
| 41 static const wchar_t* kBackgroundKey; |
| 41 static const wchar_t* kRunAtKey; | 42 static const wchar_t* kRunAtKey; |
| 42 static const wchar_t* kThemeKey; | 43 static const wchar_t* kThemeKey; |
| 43 static const wchar_t* kToolstripsKey; | 44 static const wchar_t* kToolstripsKey; |
| 44 static const wchar_t* kVersionKey; | 45 static const wchar_t* kVersionKey; |
| 45 static const wchar_t* kZipHashKey; | 46 static const wchar_t* kZipHashKey; |
| 46 | 47 |
| 47 // Some values expected in manifests. | 48 // Some values expected in manifests. |
| 48 static const char* kRunAtDocumentStartValue; | 49 static const char* kRunAtDocumentStartValue; |
| 49 static const char* kRunAtDocumentEndValue; | 50 static const char* kRunAtDocumentEndValue; |
| 50 | 51 |
| 51 // Error messages returned from InitFromValue(). | 52 // Error messages returned from InitFromValue(). |
| 52 static const char* kInvalidContentScriptError; | 53 static const char* kInvalidContentScriptError; |
| 53 static const char* kInvalidContentScriptsListError; | 54 static const char* kInvalidContentScriptsListError; |
| 54 static const char* kInvalidCssError; | 55 static const char* kInvalidCssError; |
| 55 static const char* kInvalidCssListError; | 56 static const char* kInvalidCssListError; |
| 56 static const char* kInvalidDescriptionError; | 57 static const char* kInvalidDescriptionError; |
| 57 static const char* kInvalidIdError; | 58 static const char* kInvalidIdError; |
| 58 static const char* kInvalidJsError; | 59 static const char* kInvalidJsError; |
| 59 static const char* kInvalidJsListError; | 60 static const char* kInvalidJsListError; |
| 60 static const char* kInvalidManifestError; | 61 static const char* kInvalidManifestError; |
| 61 static const char* kInvalidMatchCountError; | 62 static const char* kInvalidMatchCountError; |
| 62 static const char* kInvalidMatchError; | 63 static const char* kInvalidMatchError; |
| 63 static const char* kInvalidMatchesError; | 64 static const char* kInvalidMatchesError; |
| 64 static const char* kInvalidNameError; | 65 static const char* kInvalidNameError; |
| 65 static const char* kInvalidPluginsDirError; | 66 static const char* kInvalidPluginsDirError; |
| 67 static const char* kInvalidBackgroundError; |
| 66 static const char* kInvalidRunAtError; | 68 static const char* kInvalidRunAtError; |
| 67 static const char* kInvalidToolstripError; | 69 static const char* kInvalidToolstripError; |
| 68 static const char* kInvalidToolstripsError; | 70 static const char* kInvalidToolstripsError; |
| 69 static const char* kInvalidVersionError; | 71 static const char* kInvalidVersionError; |
| 70 static const char* kInvalidPermissionsError; | 72 static const char* kInvalidPermissionsError; |
| 71 static const char* kInvalidPermissionCountWarning; | 73 static const char* kInvalidPermissionCountWarning; |
| 72 static const char* kInvalidPermissionError; | 74 static const char* kInvalidPermissionError; |
| 73 static const char* kInvalidPermissionSchemeError; | 75 static const char* kInvalidPermissionSchemeError; |
| 74 static const char* kInvalidZipHashError; | 76 static const char* kInvalidZipHashError; |
| 75 static const char* kMissingFileError; | 77 static const char* kMissingFileError; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const FilePath& path() const { return path_; } | 117 const FilePath& path() const { return path_; } |
| 116 const GURL& url() const { return extension_url_; } | 118 const GURL& url() const { return extension_url_; } |
| 117 const std::string& id() const { return id_; } | 119 const std::string& id() const { return id_; } |
| 118 const Version* version() const { return version_.get(); } | 120 const Version* version() const { return version_.get(); } |
| 119 // String representation of the version number. | 121 // String representation of the version number. |
| 120 const std::string VersionString() const; | 122 const std::string VersionString() const; |
| 121 const std::string& name() const { return name_; } | 123 const std::string& name() const { return name_; } |
| 122 const std::string& description() const { return description_; } | 124 const std::string& description() const { return description_; } |
| 123 const UserScriptList& content_scripts() const { return content_scripts_; } | 125 const UserScriptList& content_scripts() const { return content_scripts_; } |
| 124 const FilePath& plugins_dir() const { return plugins_dir_; } | 126 const FilePath& plugins_dir() const { return plugins_dir_; } |
| 127 const GURL& background_url() const { return background_url_; } |
| 125 const std::vector<std::string>& toolstrips() const { return toolstrips_; } | 128 const std::vector<std::string>& toolstrips() const { return toolstrips_; } |
| 126 const std::vector<URLPattern>& permissions() const { | 129 const std::vector<URLPattern>& permissions() const { |
| 127 return permissions_; } | 130 return permissions_; } |
| 128 | 131 |
| 129 private: | 132 private: |
| 130 // Helper method that loads a UserScript object from a | 133 // Helper method that loads a UserScript object from a |
| 131 // dictionary in the content_script list of the manifest. | 134 // dictionary in the content_script list of the manifest. |
| 132 bool LoadUserScriptHelper(const DictionaryValue* content_script, | 135 bool LoadUserScriptHelper(const DictionaryValue* content_script, |
| 133 int definition_index, | 136 int definition_index, |
| 134 std::string* error, | 137 std::string* error, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 156 // An optional longer description of the extension. | 159 // An optional longer description of the extension. |
| 157 std::string description_; | 160 std::string description_; |
| 158 | 161 |
| 159 // Paths to the content scripts the extension contains. | 162 // Paths to the content scripts the extension contains. |
| 160 UserScriptList content_scripts_; | 163 UserScriptList content_scripts_; |
| 161 | 164 |
| 162 // Optional absolute path to the directory of NPAPI plugins that the extension | 165 // Optional absolute path to the directory of NPAPI plugins that the extension |
| 163 // contains. | 166 // contains. |
| 164 FilePath plugins_dir_; | 167 FilePath plugins_dir_; |
| 165 | 168 |
| 169 // Optional URL to a master page of which a single instance should be always |
| 170 // loaded in the background. |
| 171 GURL background_url_; |
| 172 |
| 166 // Paths to HTML files to be displayed in the toolbar. | 173 // Paths to HTML files to be displayed in the toolbar. |
| 167 std::vector<std::string> toolstrips_; | 174 std::vector<std::string> toolstrips_; |
| 168 | 175 |
| 169 // A SHA1 hash of the contents of the zip file. Note that this key is only | 176 // A SHA1 hash of the contents of the zip file. Note that this key is only |
| 170 // present in the manifest that's prepended to the zip. The inner manifest | 177 // present in the manifest that's prepended to the zip. The inner manifest |
| 171 // will not have this key. | 178 // will not have this key. |
| 172 std::string zip_hash_; | 179 std::string zip_hash_; |
| 173 | 180 |
| 174 // A map of resource id's to relative file paths. | 181 // A map of resource id's to relative file paths. |
| 175 std::map<const std::wstring, std::string> theme_paths_; | 182 std::map<const std::wstring, std::string> theme_paths_; |
| 176 | 183 |
| 184 // The sites this extension has permission to talk to (using XHR, etc). |
| 177 std::vector<URLPattern> permissions_; | 185 std::vector<URLPattern> permissions_; |
| 178 | 186 |
| 179 // We implement copy, but not assign. | 187 // We implement copy, but not assign. |
| 180 void operator=(const Extension&); | 188 void operator=(const Extension&); |
| 181 }; | 189 }; |
| 182 | 190 |
| 183 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ | 191 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |