OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPONENT_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // has been initialized, the extension is loaded; otherwise, the load is | 48 // has been initialized, the extension is loaded; otherwise, the load is |
49 // deferred until LoadAll is called. The ID of the added extension is | 49 // deferred until LoadAll is called. The ID of the added extension is |
50 // returned. | 50 // returned. |
51 // | 51 // |
52 // Component extension manifests must contain a "key" property with a unique | 52 // Component extension manifests must contain a "key" property with a unique |
53 // public key, serialized in base64. You can create a suitable value with the | 53 // public key, serialized in base64. You can create a suitable value with the |
54 // following commands on a unixy system: | 54 // following commands on a unixy system: |
55 // | 55 // |
56 // ssh-keygen -t rsa -b 1024 -N '' -f /tmp/key.pem | 56 // ssh-keygen -t rsa -b 1024 -N '' -f /tmp/key.pem |
57 // openssl rsa -pubout -outform DER < /tmp/key.pem 2>/dev/null | base64 -w 0 | 57 // openssl rsa -pubout -outform DER < /tmp/key.pem 2>/dev/null | base64 -w 0 |
58 std::string Add(const std::string& manifest_contents, | 58 std::string Add(const base::StringPiece& manifest_contents, |
59 const base::FilePath& root_directory); | 59 const base::FilePath& root_directory); |
60 | 60 |
61 // Convenience method for registering a component extension by resource id. | 61 // Convenience method for registering a component extension by resource id. |
62 std::string Add(int manifest_resource_id, | 62 std::string Add(int manifest_resource_id, |
63 const base::FilePath& root_directory); | 63 const base::FilePath& root_directory); |
64 | 64 |
65 // Loads a component extension from file system. Replaces previously added | 65 // Loads a component extension from file system. Replaces previously added |
66 // extension with the same ID. | 66 // extension with the same ID. |
67 std::string AddOrReplace(const base::FilePath& path); | 67 std::string AddOrReplace(const base::FilePath& path); |
68 | 68 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 // The component extension's ID. | 127 // The component extension's ID. |
128 std::string extension_id; | 128 std::string extension_id; |
129 }; | 129 }; |
130 | 130 |
131 // Parses the given JSON manifest. Returns nullptr if it cannot be parsed or | 131 // Parses the given JSON manifest. Returns nullptr if it cannot be parsed or |
132 // if the result is not a DictionaryValue. | 132 // if the result is not a DictionaryValue. |
133 base::DictionaryValue* ParseManifest( | 133 base::DictionaryValue* ParseManifest( |
134 base::StringPiece manifest_contents) const; | 134 base::StringPiece manifest_contents) const; |
135 | 135 |
136 std::string Add(const std::string& manifest_contents, | 136 std::string Add(const base::StringPiece& manifest_contents, |
137 const base::FilePath& root_directory, | 137 const base::FilePath& root_directory, |
138 bool skip_whitelist); | 138 bool skip_whitelist); |
139 std::string Add(const base::DictionaryValue* parsed_manifest, | 139 std::string Add(const base::DictionaryValue* parsed_manifest, |
140 const base::FilePath& root_directory, | 140 const base::FilePath& root_directory, |
141 bool skip_whitelist); | 141 bool skip_whitelist); |
142 | 142 |
143 // Loads a registered component extension. | 143 // Loads a registered component extension. |
144 void Load(const ComponentExtensionInfo& info); | 144 void Load(const ComponentExtensionInfo& info); |
145 | 145 |
146 void AddDefaultComponentExtensionsWithBackgroundPages( | 146 void AddDefaultComponentExtensionsWithBackgroundPages( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 base::WeakPtrFactory<ComponentLoader> weak_factory_; | 208 base::WeakPtrFactory<ComponentLoader> weak_factory_; |
209 | 209 |
210 friend class TtsApiTest; | 210 friend class TtsApiTest; |
211 | 211 |
212 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 212 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
213 }; | 213 }; |
214 | 214 |
215 } // namespace extensions | 215 } // namespace extensions |
216 | 216 |
217 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 217 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
OLD | NEW |