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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 // Registers and possibly loads a component extension. If ExtensionService | 34 // Registers and possibly loads a component extension. If ExtensionService |
35 // has been initialized, the extension is loaded; otherwise, the load is | 35 // has been initialized, the extension is loaded; otherwise, the load is |
36 // deferred until LoadAll is called. | 36 // deferred until LoadAll is called. |
37 const Extension* Add(std::string& manifest_contents, | 37 const Extension* Add(std::string& manifest_contents, |
38 const FilePath& root_directory); | 38 const FilePath& root_directory); |
39 | 39 |
40 // Convenience method for registering a component extension by resource id. | 40 // Convenience method for registering a component extension by resource id. |
41 const Extension* Add(int manifest_resource_id, | 41 const Extension* Add(int manifest_resource_id, |
42 const FilePath& root_directory); | 42 const FilePath& root_directory); |
43 | 43 |
44 // Loads a component extension from file system. | |
45 const Extension* AddFromCommandLine(const FilePath& path); | |
Aaron Boodman
2011/11/29 05:32:25
The fact that this comes from a command line is a
SeRya
2011/11/29 21:31:00
Renamed to AddOrReplace
| |
46 | |
44 // Unloads a component extension and removes it from the list of component | 47 // Unloads a component extension and removes it from the list of component |
45 // extensions to be loaded. | 48 // extensions to be loaded. |
46 void Remove(const FilePath& root_directory); | 49 void Remove(const FilePath& root_directory); |
47 | 50 |
51 // Removes a component extension from the list of component | |
52 // extensions to be loaded. | |
Aaron Boodman
2011/11/29 05:32:25
Nit: it looks like "extensions" fits on the previo
SeRya
2011/11/29 21:31:00
Since now comment for the prev method reflects thi
| |
53 void Remove(const std::string& id); | |
54 | |
48 // Adds the default component extensions. | 55 // Adds the default component extensions. |
49 // | 56 // |
50 // Component extension manifests must contain a 'key' property with a unique | 57 // Component extension manifests must contain a 'key' property with a unique |
51 // public key, serialized in base64. You can create a suitable value with the | 58 // public key, serialized in base64. You can create a suitable value with the |
52 // following commands on a unixy system: | 59 // following commands on a unixy system: |
53 // | 60 // |
54 // ssh-keygen -t rsa -b 1024 -N '' -f /tmp/key.pem | 61 // ssh-keygen -t rsa -b 1024 -N '' -f /tmp/key.pem |
55 // openssl rsa -pubout -outform DER < /tmp/key.pem 2>/dev/null | base64 -w 0 | 62 // openssl rsa -pubout -outform DER < /tmp/key.pem 2>/dev/null | base64 -w 0 |
56 void AddDefaultComponentExtensions(); | 63 void AddDefaultComponentExtensions(); |
57 | 64 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 const FilePath& root_directory); | 96 const FilePath& root_directory); |
90 | 97 |
91 // Loads a registered component extension. | 98 // Loads a registered component extension. |
92 const Extension* Load(const ComponentExtensionInfo& info); | 99 const Extension* Load(const ComponentExtensionInfo& info); |
93 | 100 |
94 void AddFileManagerExtension(); | 101 void AddFileManagerExtension(); |
95 | 102 |
96 // Add the enterprise webstore extension, or reload it if already loaded. | 103 // Add the enterprise webstore extension, or reload it if already loaded. |
97 void AddOrReloadEnterpriseWebStore(); | 104 void AddOrReloadEnterpriseWebStore(); |
98 | 105 |
106 // Determine the extension id and unload the extension. | |
Aaron Boodman
2011/11/29 05:32:25
Comment is incorrect, nothing is unloaded here.
SeRya
2011/11/29 21:31:00
Fixed.
| |
107 std::string GenerateId(const base::DictionaryValue* manifest); | |
Aaron Boodman
2011/11/29 05:32:25
Nit: capitalize "ID".
SeRya
2011/11/29 21:31:00
It is 'Id' everywhere except a few unit tests. Inc
| |
108 | |
99 PrefService* prefs_; | 109 PrefService* prefs_; |
100 PrefService* local_state_; | 110 PrefService* local_state_; |
101 | 111 |
102 ExtensionServiceInterface* extension_service_; | 112 ExtensionServiceInterface* extension_service_; |
103 | 113 |
104 // List of registered component extensions (see Extension::Location). | 114 // List of registered component extensions (see Extension::Location). |
105 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 115 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
106 RegisteredComponentExtensions component_extensions_; | 116 RegisteredComponentExtensions component_extensions_; |
107 | 117 |
108 PrefChangeRegistrar pref_change_registrar_; | 118 PrefChangeRegistrar pref_change_registrar_; |
109 }; | 119 }; |
110 | 120 |
111 } // namespace extensions | 121 } // namespace extensions |
112 | 122 |
113 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 123 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
OLD | NEW |