| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 30 matching lines...) Expand all Loading... |
| 41 class ResourceDispatcherHost; | 41 class ResourceDispatcherHost; |
| 42 class SiteInstance; | 42 class SiteInstance; |
| 43 class Version; | 43 class Version; |
| 44 | 44 |
| 45 // A pending extension is an extension that hasn't been installed yet | 45 // A pending extension is an extension that hasn't been installed yet |
| 46 // and is intended to be installed in the next auto-update cycle. The | 46 // and is intended to be installed in the next auto-update cycle. The |
| 47 // update URL of a pending extension may be blank, in which case a | 47 // update URL of a pending extension may be blank, in which case a |
| 48 // default one is assumed. | 48 // default one is assumed. |
| 49 struct PendingExtensionInfo { | 49 struct PendingExtensionInfo { |
| 50 PendingExtensionInfo(const GURL& update_url, | 50 PendingExtensionInfo(const GURL& update_url, |
| 51 const Version& version, | |
| 52 bool is_theme, | 51 bool is_theme, |
| 53 bool install_silently); | 52 bool install_silently, |
| 53 bool enable_on_install, |
| 54 bool enable_incognito_on_install); |
| 54 | 55 |
| 55 PendingExtensionInfo(); | 56 PendingExtensionInfo(); |
| 56 | 57 |
| 57 GURL update_url; | 58 GURL update_url; |
| 58 Version version; | |
| 59 bool is_theme; | 59 bool is_theme; |
| 60 bool install_silently; | 60 bool install_silently; |
| 61 bool enable_on_install; |
| 62 bool enable_incognito_on_install; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 // A PendingExtensionMap is a map from IDs of pending extensions to | 65 // A PendingExtensionMap is a map from IDs of pending extensions to |
| 64 // their info. | 66 // their info. |
| 65 typedef std::map<std::string, PendingExtensionInfo> PendingExtensionMap; | 67 typedef std::map<std::string, PendingExtensionInfo> PendingExtensionMap; |
| 66 | 68 |
| 67 // This is an interface class to encapsulate the dependencies that | 69 // This is an interface class to encapsulate the dependencies that |
| 68 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. | 70 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. |
| 69 class ExtensionUpdateService { | 71 class ExtensionUpdateService { |
| 70 public: | 72 public: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 virtual void UpdateExtension(const std::string& id, | 196 virtual void UpdateExtension(const std::string& id, |
| 195 const FilePath& extension_path, | 197 const FilePath& extension_path, |
| 196 const GURL& download_url); | 198 const GURL& download_url); |
| 197 | 199 |
| 198 // Adds an extension in a pending state; the extension with the | 200 // Adds an extension in a pending state; the extension with the |
| 199 // given info will be installed on the next auto-update cycle. | 201 // given info will be installed on the next auto-update cycle. |
| 200 // | 202 // |
| 201 // It is an error to call this with an already-installed extension | 203 // It is an error to call this with an already-installed extension |
| 202 // (even a disabled one). | 204 // (even a disabled one). |
| 203 // | 205 // |
| 204 // TODO(akalin): Make sure that all the places that check for | 206 // TODO(akalin): Replace |install_silently| with a list of |
| 205 // existing versions also consult the pending extension info. | 207 // pre-enabled permissions. |
| 206 void AddPendingExtension( | 208 void AddPendingExtension( |
| 207 const std::string& id, const GURL& update_url, | 209 const std::string& id, const GURL& update_url, |
| 208 const Version& version, bool is_theme, bool install_silently); | 210 bool is_theme, bool install_silently, |
| 211 bool enable_on_install, bool enable_incognito_on_install); |
| 209 | 212 |
| 210 // Reloads the specified extension. | 213 // Reloads the specified extension. |
| 211 void ReloadExtension(const std::string& extension_id); | 214 void ReloadExtension(const std::string& extension_id); |
| 212 | 215 |
| 213 // Uninstalls the specified extension. Callers should only call this method | 216 // Uninstalls the specified extension. Callers should only call this method |
| 214 // with extensions that exist. |external_uninstall| is a magical parameter | 217 // with extensions that exist. |external_uninstall| is a magical parameter |
| 215 // that is only used to send information to ExtensionPrefs, which external | 218 // that is only used to send information to ExtensionPrefs, which external |
| 216 // callers should never set to true. | 219 // callers should never set to true. |
| 217 // TODO(aa): Remove |external_uninstall| -- this information should be passed | 220 // TODO(aa): Remove |external_uninstall| -- this information should be passed |
| 218 // to ExtensionPrefs some other way. | 221 // to ExtensionPrefs some other way. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // Look up an extension by ID, optionally including either or both of enabled | 356 // Look up an extension by ID, optionally including either or both of enabled |
| 354 // and disabled extensions. | 357 // and disabled extensions. |
| 355 Extension* GetExtensionByIdInternal(const std::string& id, | 358 Extension* GetExtensionByIdInternal(const std::string& id, |
| 356 bool include_enabled, | 359 bool include_enabled, |
| 357 bool include_disabled); | 360 bool include_disabled); |
| 358 | 361 |
| 359 // Like AddPendingExtension() but assumes an extension with the same | 362 // Like AddPendingExtension() but assumes an extension with the same |
| 360 // id is not already installed. | 363 // id is not already installed. |
| 361 void AddPendingExtensionInternal( | 364 void AddPendingExtensionInternal( |
| 362 const std::string& id, const GURL& update_url, | 365 const std::string& id, const GURL& update_url, |
| 363 const Version& version, bool is_theme, bool install_silently); | 366 bool is_theme, bool install_silently, |
| 367 bool enable_on_install, bool enable_incognito_on_install); |
| 364 | 368 |
| 365 // Handles sending notification that |extension| was loaded. | 369 // Handles sending notification that |extension| was loaded. |
| 366 void NotifyExtensionLoaded(Extension* extension); | 370 void NotifyExtensionLoaded(Extension* extension); |
| 367 | 371 |
| 368 // Handles sending notification that |extension| was unloaded. | 372 // Handles sending notification that |extension| was unloaded. |
| 369 void NotifyExtensionUnloaded(Extension* extension); | 373 void NotifyExtensionUnloaded(Extension* extension); |
| 370 | 374 |
| 371 // Helper that updates the active extension list used for crash reporting. | 375 // Helper that updates the active extension list used for crash reporting. |
| 372 void UpdateActiveExtensionsInCrashReporter(); | 376 void UpdateActiveExtensionsInCrashReporter(); |
| 373 | 377 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 540 |
| 537 // A map of all external extension providers. | 541 // A map of all external extension providers. |
| 538 typedef std::map<Extension::Location, | 542 typedef std::map<Extension::Location, |
| 539 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 543 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
| 540 ProviderMap external_extension_providers_; | 544 ProviderMap external_extension_providers_; |
| 541 | 545 |
| 542 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 546 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 543 }; | 547 }; |
| 544 | 548 |
| 545 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 549 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |