Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 6961027: Change event routers from singletons to being owned by the ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asargent and dmazzoni's comments Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/extensions/pending_extension_manager.h" 32 #include "chrome/browser/extensions/pending_extension_manager.h"
33 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" 33 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
34 #include "chrome/browser/prefs/pref_change_registrar.h" 34 #include "chrome/browser/prefs/pref_change_registrar.h"
35 #include "chrome/common/extensions/extension.h" 35 #include "chrome/common/extensions/extension.h"
36 #include "content/browser/browser_thread.h" 36 #include "content/browser/browser_thread.h"
37 #include "content/common/notification_observer.h" 37 #include "content/common/notification_observer.h"
38 #include "content/common/notification_registrar.h" 38 #include "content/common/notification_registrar.h"
39 #include "content/common/property_bag.h" 39 #include "content/common/property_bag.h"
40 40
41 class CrxInstaller; 41 class CrxInstaller;
42 class ExtensionAccessibilityEventRouter;
43 class ExtensionBookmarkEventRouter;
42 class ExtensionBrowserEventRouter; 44 class ExtensionBrowserEventRouter;
43 class ExtensionContentSettingsStore; 45 class ExtensionContentSettingsStore;
46 class ExtensionCookiesEventRouter;
47 class ExtensionFileBrowserEventRouter;
48 class ExtensionHistoryEventRouter;
44 class ExtensionInstallUI; 49 class ExtensionInstallUI;
50 class ExtensionManagementEventRouter;
45 class ExtensionPreferenceEventRouter; 51 class ExtensionPreferenceEventRouter;
52 class ExtensionProcessesEventRouter;
53 class ExtensionWebNavigationEventRouter;
46 class ExtensionServiceBackend; 54 class ExtensionServiceBackend;
47 struct ExtensionSyncData; 55 struct ExtensionSyncData;
48 class ExtensionToolbarModel; 56 class ExtensionToolbarModel;
49 class ExtensionUpdater; 57 class ExtensionUpdater;
50 class GURL; 58 class GURL;
51 class PendingExtensionManager; 59 class PendingExtensionManager;
52 class Profile; 60 class Profile;
53 class Version; 61 class Version;
54 62
55 // This is an interface class to encapsulate the dependencies that 63 // This is an interface class to encapsulate the dependencies that
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 435
428 // Note that this may return NULL if autoupdate is not turned on. 436 // Note that this may return NULL if autoupdate is not turned on.
429 ExtensionUpdater* updater(); 437 ExtensionUpdater* updater();
430 438
431 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } 439 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; }
432 440
433 ExtensionsQuotaService* quota_service() { return &quota_service_; } 441 ExtensionsQuotaService* quota_service() { return &quota_service_; }
434 442
435 ExtensionMenuManager* menu_manager() { return &menu_manager_; } 443 ExtensionMenuManager* menu_manager() { return &menu_manager_; }
436 444
445 ExtensionAccessibilityEventRouter* accessibility_event_router() {
446 return accessibility_event_router_.get();
447 }
448
437 ExtensionBrowserEventRouter* browser_event_router() { 449 ExtensionBrowserEventRouter* browser_event_router() {
438 return browser_event_router_.get(); 450 return browser_event_router_.get();
439 } 451 }
440 452
453 ExtensionProcessesEventRouter* processes_event_router() {
454 return processes_event_router_.get();
455 }
456
441 // Notify the frontend that there was an error loading an extension. 457 // Notify the frontend that there was an error loading an extension.
442 // This method is public because ExtensionServiceBackend can post to here. 458 // This method is public because ExtensionServiceBackend can post to here.
443 void ReportExtensionLoadError(const FilePath& extension_path, 459 void ReportExtensionLoadError(const FilePath& extension_path,
444 const std::string& error, 460 const std::string& error,
445 NotificationType type, 461 NotificationType type,
446 bool be_noisy); 462 bool be_noisy);
447 463
448 // ExtensionHost of background page calls this method right after its render 464 // ExtensionHost of background page calls this method right after its render
449 // view has been created. 465 // view has been created.
450 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host); 466 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // List of registered component extensions (see Extension::Location). 684 // List of registered component extensions (see Extension::Location).
669 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; 685 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions;
670 RegisteredComponentExtensions component_extension_manifests_; 686 RegisteredComponentExtensions component_extension_manifests_;
671 687
672 // Manages the promotion of the web store. 688 // Manages the promotion of the web store.
673 AppsPromo apps_promo_; 689 AppsPromo apps_promo_;
674 690
675 // Flag to make sure event routers are only initialized once. 691 // Flag to make sure event routers are only initialized once.
676 bool event_routers_initialized_; 692 bool event_routers_initialized_;
677 693
694 scoped_ptr<ExtensionHistoryEventRouter> history_event_router_;
695 scoped_ptr<ExtensionAccessibilityEventRouter> accessibility_event_router_;
678 scoped_ptr<ExtensionBrowserEventRouter> browser_event_router_; 696 scoped_ptr<ExtensionBrowserEventRouter> browser_event_router_;
697 scoped_ptr<ExtensionPreferenceEventRouter> preference_event_router_;
698 scoped_ptr<ExtensionBookmarkEventRouter> bookmark_event_router_;
699 scoped_ptr<ExtensionCookiesEventRouter> cookies_event_router_;
700 scoped_ptr<ExtensionManagementEventRouter> management_event_router_;
701 scoped_ptr<ExtensionProcessesEventRouter> processes_event_router_;
702 scoped_ptr<ExtensionWebNavigationEventRouter> web_navigation_event_router_;
679 703
680 scoped_ptr<ExtensionPreferenceEventRouter> preference_event_router_; 704 #if defined(OS_CHROMEOS)
705 scoped_ptr<ExtensionFileBrowserEventRouter> file_browser_event_router_;
706 #endif
681 707
682 // A collection of external extension providers. Each provider reads 708 // A collection of external extension providers. Each provider reads
683 // a source of external extension information. Examples include the 709 // a source of external extension information. Examples include the
684 // windows registry and external_extensions.json. 710 // windows registry and external_extensions.json.
685 ProviderCollection external_extension_providers_; 711 ProviderCollection external_extension_providers_;
686 712
687 // Set to true by OnExternalExtensionUpdateUrlFound() when an external 713 // Set to true by OnExternalExtensionUpdateUrlFound() when an external
688 // extension URL is found. Used in CheckForExternalUpdates() to see 714 // extension URL is found. Used in CheckForExternalUpdates() to see
689 // if an update check is needed to install pending extensions. 715 // if an update check is needed to install pending extensions.
690 bool external_extension_url_added_; 716 bool external_extension_url_added_;
691 717
692 NaClModuleInfoList nacl_module_list_; 718 NaClModuleInfoList nacl_module_list_;
693 719
694 // The back end needs to reference nacl_module_list_. 720 // The back end needs to reference nacl_module_list_.
695 friend class ExtensionServiceBackend; 721 friend class ExtensionServiceBackend;
696 722
697 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 723 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
698 InstallAppsWithUnlimtedStorage); 724 InstallAppsWithUnlimtedStorage);
699 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 725 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
700 InstallAppsAndCheckStorageProtection); 726 InstallAppsAndCheckStorageProtection);
701 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 727 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
702 }; 728 };
703 729
704 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 730 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698