| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 MessageLoop* frontend_loop, | 82 MessageLoop* frontend_loop, |
| 83 MessageLoop* backend_loop, | 83 MessageLoop* backend_loop, |
| 84 bool autoupdate_enabled); | 84 bool autoupdate_enabled); |
| 85 virtual ~ExtensionsService(); | 85 virtual ~ExtensionsService(); |
| 86 | 86 |
| 87 // Gets the list of currently installed extensions. | 87 // Gets the list of currently installed extensions. |
| 88 virtual const ExtensionList* extensions() const { | 88 virtual const ExtensionList* extensions() const { |
| 89 return &extensions_; | 89 return &extensions_; |
| 90 } | 90 } |
| 91 | 91 |
| 92 const FilePath& install_directory() const { return install_directory_; } |
| 93 |
| 92 // Initialize and start all installed extensions. | 94 // Initialize and start all installed extensions. |
| 93 void Init(); | 95 void Init(); |
| 94 | 96 |
| 95 // Install the extension file at |extension_path|. Will install as an | 97 // Install the extension file at |extension_path|. Will install as an |
| 96 // update if an older version is already installed. | 98 // update if an older version is already installed. |
| 97 // For fresh installs, this method also causes the extension to be | 99 // For fresh installs, this method also causes the extension to be |
| 98 // immediately loaded. | 100 // immediately loaded. |
| 101 // TODO(aa): This method can be removed. It is only used by the unit tests, |
| 102 // and they could use CrxInstaller directly instead. |
| 99 void InstallExtension(const FilePath& extension_path); | 103 void InstallExtension(const FilePath& extension_path); |
| 100 | 104 |
| 101 // XXX Hack: This is a temporary nasty hack to get theme installation working | |
| 102 // without a dialog. Will be fixed by making ExtensionsService more modular. | |
| 103 void InstallExtension(const FilePath& extension_path, | |
| 104 const GURL& download_url, | |
| 105 const GURL& referrer_url); | |
| 106 | |
| 107 // Updates a currently-installed extension with the contents from | 105 // Updates a currently-installed extension with the contents from |
| 108 // |extension_path|. | 106 // |extension_path|. |
| 107 // TODO(aa): This method can be removed. ExtensionUpdater could use |
| 108 // CrxInstaller directly instead. |
| 109 virtual void UpdateExtension(const std::string& id, | 109 virtual void UpdateExtension(const std::string& id, |
| 110 const FilePath& extension_path); | 110 const FilePath& extension_path); |
| 111 | 111 |
| 112 // Reloads the specified extension. | 112 // Reloads the specified extension. |
| 113 void ReloadExtension(const std::string& extension_id); | 113 void ReloadExtension(const std::string& extension_id); |
| 114 | 114 |
| 115 // Uninstalls the specified extension. Callers should only call this method | 115 // Uninstalls the specified extension. Callers should only call this method |
| 116 // with extensions that exist. |external_uninstall| is a magical parameter | 116 // with extensions that exist. |external_uninstall| is a magical parameter |
| 117 // that is only used to send information to ExtensionPrefs, which external | 117 // that is only used to send information to ExtensionPrefs, which external |
| 118 // callers should never set to true. | 118 // callers should never set to true. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 // Profile calls this when it is destroyed so that we know not to call it. | 189 // Profile calls this when it is destroyed so that we know not to call it. |
| 190 void ProfileDestroyed() { profile_ = NULL; } | 190 void ProfileDestroyed() { profile_ = NULL; } |
| 191 | 191 |
| 192 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } | 192 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } |
| 193 | 193 |
| 194 // Whether the extension service is ready. | 194 // Whether the extension service is ready. |
| 195 bool is_ready() { return ready_; } | 195 bool is_ready() { return ready_; } |
| 196 | 196 |
| 197 private: | 197 private: |
| 198 // Show a confirm installation infobar on the currently active tab. | |
| 199 // TODO(aa): This should be moved up into the UI and attached to the tab it | |
| 200 // actually occured in. This requires some modularization of | |
| 201 // ExtensionsService. | |
| 202 bool ShowThemePreviewInfobar(Extension* extension); | |
| 203 | |
| 204 // The profile this ExtensionsService is part of. | 198 // The profile this ExtensionsService is part of. |
| 205 Profile* profile_; | 199 Profile* profile_; |
| 206 | 200 |
| 207 // Preferences for the owning profile. | 201 // Preferences for the owning profile. |
| 208 scoped_ptr<ExtensionPrefs> extension_prefs_; | 202 scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 209 | 203 |
| 210 // The message loop to use with the backend. | 204 // The message loop to use with the backend. |
| 211 MessageLoop* backend_loop_; | 205 MessageLoop* backend_loop_; |
| 212 | 206 |
| 213 // The current list of installed extensions. | 207 // The current list of installed extensions. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 337 |
| 344 // A map of all external extension providers. | 338 // A map of all external extension providers. |
| 345 typedef std::map<Extension::Location, | 339 typedef std::map<Extension::Location, |
| 346 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 340 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
| 347 ProviderMap external_extension_providers_; | 341 ProviderMap external_extension_providers_; |
| 348 | 342 |
| 349 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 343 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 350 }; | 344 }; |
| 351 | 345 |
| 352 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 346 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |