| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // The |relative_path| can be untrusted user input. The returned path will | 93 // The |relative_path| can be untrusted user input. The returned path will |
| 94 // either be empty or a child of extension_path. | 94 // either be empty or a child of extension_path. |
| 95 // NOTE: Static so that it can be used from multiple threads. | 95 // NOTE: Static so that it can be used from multiple threads. |
| 96 static FilePath GetResourcePath(const FilePath& extension_path, | 96 static FilePath GetResourcePath(const FilePath& extension_path, |
| 97 const std::string& relative_path); | 97 const std::string& relative_path); |
| 98 FilePath GetResourcePath(const std::string& relative_path) { | 98 FilePath GetResourcePath(const std::string& relative_path) { |
| 99 return GetResourcePath(path(), relative_path); | 99 return GetResourcePath(path(), relative_path); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // Initialize the extension from a parsed manifest. | 102 // Initialize the extension from a parsed manifest. |
| 103 // If |require_id| is true, will return an error if the "id" key is missing | 103 bool InitFromValue(const DictionaryValue& value, std::string* error); |
| 104 // from the value. | |
| 105 bool InitFromValue(const DictionaryValue& value, bool require_id, | |
| 106 std::string* error); | |
| 107 | 104 |
| 108 // Returns an absolute path to a resource inside of an extension if the | 105 // Returns an absolute path to a resource inside of an extension if the |
| 109 // extension has a theme defined with the given |resource_id|. Otherwise | 106 // extension has a theme defined with the given |resource_id|. Otherwise |
| 110 // the path will be empty. Note that this method is not static as it is | 107 // the path will be empty. Note that this method is not static as it is |
| 111 // only intended to be called on an extension which has registered itself | 108 // only intended to be called on an extension which has registered itself |
| 112 // as providing a theme. | 109 // as providing a theme. |
| 113 FilePath GetThemeResourcePath(const int resource_id); | 110 FilePath GetThemeResourcePath(const int resource_id); |
| 114 | 111 |
| 115 const FilePath& path() const { return path_; } | 112 const FilePath& path() const { return path_; } |
| 116 const GURL& url() const { return extension_url_; } | 113 const GURL& url(); |
| 117 const std::string& id() const { return id_; } | 114 const std::string& id() const { return id_; } |
| 115 void set_id(const std::string& id); |
| 118 const Version* version() const { return version_.get(); } | 116 const Version* version() const { return version_.get(); } |
| 119 // String representation of the version number. | 117 // String representation of the version number. |
| 120 const std::string VersionString() const; | 118 const std::string VersionString() const; |
| 121 const std::string& name() const { return name_; } | 119 const std::string& name() const { return name_; } |
| 122 const std::string& description() const { return description_; } | 120 const std::string& description() const { return description_; } |
| 123 const UserScriptList& content_scripts() const { return content_scripts_; } | 121 const UserScriptList& content_scripts() const { return content_scripts_; } |
| 124 const FilePath& plugins_dir() const { return plugins_dir_; } | 122 const FilePath& plugins_dir() const { return plugins_dir_; } |
| 125 const std::vector<std::string>& toolstrips() const { return toolstrips_; } | 123 const std::vector<std::string>& toolstrips() const { return toolstrips_; } |
| 126 const std::vector<URLPattern>& permissions() const { | 124 const std::vector<URLPattern>& permissions() const { |
| 127 return permissions_; } | 125 return permissions_; } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // A map of resource id's to relative file paths. | 172 // A map of resource id's to relative file paths. |
| 175 std::map<const std::wstring, std::string> theme_paths_; | 173 std::map<const std::wstring, std::string> theme_paths_; |
| 176 | 174 |
| 177 std::vector<URLPattern> permissions_; | 175 std::vector<URLPattern> permissions_; |
| 178 | 176 |
| 179 // We implement copy, but not assign. | 177 // We implement copy, but not assign. |
| 180 void operator=(const Extension&); | 178 void operator=(const Extension&); |
| 181 }; | 179 }; |
| 182 | 180 |
| 183 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ | 181 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |