| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/linked_ptr.h" | 16 #include "base/linked_ptr.h" |
| 17 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 18 #include "base/task.h" | 18 #include "base/task.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #include "base/tuple.h" | 20 #include "base/tuple.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/chrome_thread.h" | 22 #include "chrome/browser/chrome_thread.h" |
| 23 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 23 #include "chrome/browser/extensions/extension_menu_manager.h" | 24 #include "chrome/browser/extensions/extension_menu_manager.h" |
| 24 #include "chrome/browser/extensions/extension_prefs.h" | 25 #include "chrome/browser/extensions/extension_prefs.h" |
| 25 #include "chrome/browser/extensions/extension_process_manager.h" | 26 #include "chrome/browser/extensions/extension_process_manager.h" |
| 26 #include "chrome/browser/extensions/extension_toolbar_model.h" | 27 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 27 #include "chrome/browser/extensions/extensions_quota_service.h" | 28 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 28 #include "chrome/browser/extensions/external_extension_provider.h" | 29 #include "chrome/browser/extensions/external_extension_provider.h" |
| 29 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 30 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
| 30 #include "chrome/common/notification_observer.h" | 31 #include "chrome/common/notification_observer.h" |
| 31 #include "chrome/common/notification_registrar.h" | 32 #include "chrome/common/notification_registrar.h" |
| 32 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 Extension* GetExtensionByURL(const GURL& url); | 269 Extension* GetExtensionByURL(const GURL& url); |
| 269 | 270 |
| 270 // If there is an extension for the specified url it is returned. Otherwise | 271 // If there is an extension for the specified url it is returned. Otherwise |
| 271 // returns the extension whose web extent contains |url|. | 272 // returns the extension whose web extent contains |url|. |
| 272 Extension* GetExtensionByWebExtent(const GURL& url); | 273 Extension* GetExtensionByWebExtent(const GURL& url); |
| 273 | 274 |
| 274 // Returns an extension that contains any URL that overlaps with the given | 275 // Returns an extension that contains any URL that overlaps with the given |
| 275 // extent, if one exists. | 276 // extent, if one exists. |
| 276 Extension* GetExtensionByOverlappingWebExtent(const ExtensionExtent& extent); | 277 Extension* GetExtensionByOverlappingWebExtent(const ExtensionExtent& extent); |
| 277 | 278 |
| 279 // Returns the icon to display in the omnibox for the given extension. |
| 280 const SkBitmap& GetOmniboxIcon(const std::string& extension_id); |
| 281 |
| 278 // Clear all ExternalExtensionProviders. | 282 // Clear all ExternalExtensionProviders. |
| 279 void ClearProvidersForTesting(); | 283 void ClearProvidersForTesting(); |
| 280 | 284 |
| 281 // Sets an ExternalExtensionProvider for the service to use during testing. | 285 // Sets an ExternalExtensionProvider for the service to use during testing. |
| 282 // |location| specifies what type of provider should be added. | 286 // |location| specifies what type of provider should be added. |
| 283 void SetProviderForTesting(Extension::Location location, | 287 void SetProviderForTesting(Extension::Location location, |
| 284 ExternalExtensionProvider* test_provider); | 288 ExternalExtensionProvider* test_provider); |
| 285 | 289 |
| 286 // Called when the initial extensions load has completed. | 290 // Called when the initial extensions load has completed. |
| 287 virtual void OnLoadedInstalledExtensions(); | 291 virtual void OnLoadedInstalledExtensions(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // Whether the extension service is ready. | 330 // Whether the extension service is ready. |
| 327 bool is_ready() { return ready_; } | 331 bool is_ready() { return ready_; } |
| 328 | 332 |
| 329 // Note that this may return NULL if autoupdate is not turned on. | 333 // Note that this may return NULL if autoupdate is not turned on. |
| 330 ExtensionUpdater* updater() { return updater_.get(); } | 334 ExtensionUpdater* updater() { return updater_.get(); } |
| 331 | 335 |
| 332 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } | 336 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } |
| 333 | 337 |
| 334 ExtensionsQuotaService* quota_service() { return "a_service_; } | 338 ExtensionsQuotaService* quota_service() { return "a_service_; } |
| 335 | 339 |
| 336 // Access to menu items added by extensions. | |
| 337 ExtensionMenuManager* menu_manager() { return &menu_manager_; } | 340 ExtensionMenuManager* menu_manager() { return &menu_manager_; } |
| 338 | 341 |
| 339 // Notify the frontend that there was an error loading an extension. | 342 // Notify the frontend that there was an error loading an extension. |
| 340 // This method is public because ExtensionsServiceBackend can post to here. | 343 // This method is public because ExtensionsServiceBackend can post to here. |
| 341 void ReportExtensionLoadError(const FilePath& extension_path, | 344 void ReportExtensionLoadError(const FilePath& extension_path, |
| 342 const std::string& error, | 345 const std::string& error, |
| 343 NotificationType type, | 346 NotificationType type, |
| 344 bool be_noisy); | 347 bool be_noisy); |
| 345 | 348 |
| 346 // NotificationObserver | 349 // NotificationObserver |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // Map of inspector cookies that are detached, waiting for an extension to be | 432 // Map of inspector cookies that are detached, waiting for an extension to be |
| 430 // reloaded. | 433 // reloaded. |
| 431 typedef std::map<std::string, int> OrphanedDevTools; | 434 typedef std::map<std::string, int> OrphanedDevTools; |
| 432 OrphanedDevTools orphaned_dev_tools_; | 435 OrphanedDevTools orphaned_dev_tools_; |
| 433 | 436 |
| 434 NotificationRegistrar registrar_; | 437 NotificationRegistrar registrar_; |
| 435 | 438 |
| 436 // Keeps track of menu items added by extensions. | 439 // Keeps track of menu items added by extensions. |
| 437 ExtensionMenuManager menu_manager_; | 440 ExtensionMenuManager menu_manager_; |
| 438 | 441 |
| 442 // Keeps track of favicon-sized omnibox icons for extensions. |
| 443 ExtensionIconManager omnibox_icon_manager_; |
| 444 |
| 439 // List of registered component extensions (see Extension::Location). | 445 // List of registered component extensions (see Extension::Location). |
| 440 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 446 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
| 441 RegisteredComponentExtensions component_extension_manifests_; | 447 RegisteredComponentExtensions component_extension_manifests_; |
| 442 | 448 |
| 443 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 449 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 444 UpdatePendingExtensionAlreadyInstalled); | 450 UpdatePendingExtensionAlreadyInstalled); |
| 445 | 451 |
| 446 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); | 452 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); |
| 447 }; | 453 }; |
| 448 | 454 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 549 |
| 544 // A map of all external extension providers. | 550 // A map of all external extension providers. |
| 545 typedef std::map<Extension::Location, | 551 typedef std::map<Extension::Location, |
| 546 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 552 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
| 547 ProviderMap external_extension_providers_; | 553 ProviderMap external_extension_providers_; |
| 548 | 554 |
| 549 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 555 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 550 }; | 556 }; |
| 551 | 557 |
| 552 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 558 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |