| 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_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 <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/extensions/extension_process_manager.h" | 30 #include "chrome/browser/extensions/extension_process_manager.h" |
| 31 #include "chrome/browser/extensions/extension_sync_data.h" | 31 #include "chrome/browser/extensions/extension_sync_data.h" |
| 32 #include "chrome/browser/extensions/extension_toolbar_model.h" | 32 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 33 #include "chrome/browser/extensions/extension_warning_set.h" | 33 #include "chrome/browser/extensions/extension_warning_set.h" |
| 34 #include "chrome/browser/extensions/extensions_quota_service.h" | 34 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 35 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 35 #include "chrome/browser/extensions/external_extension_provider_interface.h" |
| 36 #include "chrome/browser/extensions/pending_extension_manager.h" | 36 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 37 #include "chrome/browser/extensions/process_map.h" | 37 #include "chrome/browser/extensions/process_map.h" |
| 38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
| 39 #include "chrome/browser/prefs/pref_change_registrar.h" | 39 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 40 #include "chrome/browser/shell_integration.h" |
| 40 #include "chrome/browser/sync/api/sync_change.h" | 41 #include "chrome/browser/sync/api/sync_change.h" |
| 41 #include "chrome/browser/sync/api/syncable_service.h" | 42 #include "chrome/browser/sync/api/syncable_service.h" |
| 42 #include "chrome/common/extensions/extension.h" | 43 #include "chrome/common/extensions/extension.h" |
| 43 #include "chrome/common/extensions/extension_constants.h" | 44 #include "chrome/common/extensions/extension_constants.h" |
| 44 #include "chrome/common/extensions/extension_set.h" | 45 #include "chrome/common/extensions/extension_set.h" |
| 45 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
| 46 #include "content/public/browser/notification_observer.h" | 47 #include "content/public/browser/notification_observer.h" |
| 47 #include "content/public/browser/notification_registrar.h" | 48 #include "content/public/browser/notification_registrar.h" |
| 48 | 49 |
| 49 class AppNotificationManager; | 50 class AppNotificationManager; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 extension_misc::UnloadedExtensionReason reason) = 0; | 125 extension_misc::UnloadedExtensionReason reason) = 0; |
| 125 | 126 |
| 126 virtual bool is_ready() = 0; | 127 virtual bool is_ready() = 0; |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 // Manages installed and running Chromium extensions. | 130 // Manages installed and running Chromium extensions. |
| 130 class ExtensionService | 131 class ExtensionService |
| 131 : public ExtensionServiceInterface, | 132 : public ExtensionServiceInterface, |
| 132 public ExternalExtensionProviderInterface::VisitorInterface, | 133 public ExternalExtensionProviderInterface::VisitorInterface, |
| 133 public base::SupportsWeakPtr<ExtensionService>, | 134 public base::SupportsWeakPtr<ExtensionService>, |
| 134 public content::NotificationObserver { | 135 public content::NotificationObserver, |
| 136 public ImageLoadingTracker::Observer { |
| 135 public: | 137 public: |
| 136 using base::SupportsWeakPtr<ExtensionService>::AsWeakPtr; | 138 using base::SupportsWeakPtr<ExtensionService>::AsWeakPtr; |
| 137 | 139 |
| 138 // The name of the directory inside the profile where extensions are | 140 // The name of the directory inside the profile where extensions are |
| 139 // installed to. | 141 // installed to. |
| 140 static const char* kInstallDirectoryName; | 142 static const char* kInstallDirectoryName; |
| 141 | 143 |
| 142 // If auto-updates are turned on, default to running every 5 hours. | 144 // If auto-updates are turned on, default to running every 5 hours. |
| 143 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; | 145 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; |
| 144 | 146 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 #endif | 569 #endif |
| 568 | 570 |
| 569 ExtensionWarningSet* extension_warnings() { | 571 ExtensionWarningSet* extension_warnings() { |
| 570 return &extension_warnings_; | 572 return &extension_warnings_; |
| 571 } | 573 } |
| 572 | 574 |
| 573 extensions::SocketController* socket_controller() { | 575 extensions::SocketController* socket_controller() { |
| 574 return socket_controller_; | 576 return socket_controller_; |
| 575 } | 577 } |
| 576 | 578 |
| 579 // Implement ImageLoadingTracker::Observer. |tracker_| is used to |
| 580 // load the application's icon, which is done when we start creating an |
| 581 // application's shortcuts. This method receives the icon, and completes |
| 582 // the process of installing the shortcuts. |
| 583 virtual void OnImageLoaded(SkBitmap* image, |
| 584 const ExtensionResource& resource, |
| 585 int index) OVERRIDE; |
| 577 private: | 586 private: |
| 578 // Bundle of type (app or extension)-specific sync stuff. | 587 // Bundle of type (app or extension)-specific sync stuff. |
| 579 struct SyncBundle { | 588 struct SyncBundle { |
| 580 SyncBundle(); | 589 SyncBundle(); |
| 581 ~SyncBundle(); | 590 ~SyncBundle(); |
| 582 | 591 |
| 583 bool HasExtensionId(const std::string& id) const; | 592 bool HasExtensionId(const std::string& id) const; |
| 584 bool HasPendingExtensionId(const std::string& id) const; | 593 bool HasPendingExtensionId(const std::string& id) const; |
| 585 | 594 |
| 586 ExtensionFilter filter; | 595 ExtensionFilter filter; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 // type, just the ones that are responsible for rendering a particular MIME | 690 // type, just the ones that are responsible for rendering a particular MIME |
| 682 // type, like application/pdf. Note: We only register NaCl modules in the | 691 // type, like application/pdf. Note: We only register NaCl modules in the |
| 683 // browser process. | 692 // browser process. |
| 684 void RegisterNaClModule(const GURL& url, const std::string& mime_type); | 693 void RegisterNaClModule(const GURL& url, const std::string& mime_type); |
| 685 void UnregisterNaClModule(const GURL& url); | 694 void UnregisterNaClModule(const GURL& url); |
| 686 | 695 |
| 687 // Call UpdatePluginListWithNaClModules() after registering or unregistering | 696 // Call UpdatePluginListWithNaClModules() after registering or unregistering |
| 688 // a NaCl module to see those changes reflected in the PluginList. | 697 // a NaCl module to see those changes reflected in the PluginList. |
| 689 void UpdatePluginListWithNaClModules(); | 698 void UpdatePluginListWithNaClModules(); |
| 690 | 699 |
| 700 // Start the process of installing an application shortcut. |
| 701 // The process is finished when OnImageLoaded is called. |
| 702 void StartInstallApplicationShortcut(const Extension* extension); |
| 703 |
| 691 NaClModuleInfoList::iterator FindNaClModule(const GURL& url); | 704 NaClModuleInfoList::iterator FindNaClModule(const GURL& url); |
| 692 | 705 |
| 693 // The profile this ExtensionService is part of. | 706 // The profile this ExtensionService is part of. |
| 694 Profile* profile_; | 707 Profile* profile_; |
| 695 | 708 |
| 696 // Preferences for the owning profile (weak reference). | 709 // Preferences for the owning profile (weak reference). |
| 697 ExtensionPrefs* extension_prefs_; | 710 ExtensionPrefs* extension_prefs_; |
| 698 | 711 |
| 699 // Settings for the owning profile. | 712 // Settings for the owning profile. |
| 700 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; | 713 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 836 |
| 824 // Contains an entry for each warning that shall be currently shown. | 837 // Contains an entry for each warning that shall be currently shown. |
| 825 ExtensionWarningSet extension_warnings_; | 838 ExtensionWarningSet extension_warnings_; |
| 826 | 839 |
| 827 // We need to control destruction of this object (it needs to happen on the | 840 // We need to control destruction of this object (it needs to happen on the |
| 828 // IO thread), so we don't get to use any RAII devices with it. | 841 // IO thread), so we don't get to use any RAII devices with it. |
| 829 extensions::SocketController* socket_controller_; | 842 extensions::SocketController* socket_controller_; |
| 830 | 843 |
| 831 extensions::ProcessMap process_map_; | 844 extensions::ProcessMap process_map_; |
| 832 | 845 |
| 846 // Fields used when installing application shortcuts. |
| 847 ShellIntegration::ShortcutInfo shortcut_info_; |
| 848 ImageLoadingTracker tracker_; |
| 849 |
| 833 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 850 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 834 InstallAppsWithUnlimtedStorage); | 851 InstallAppsWithUnlimtedStorage); |
| 835 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 836 InstallAppsAndCheckStorageProtection); | 853 InstallAppsAndCheckStorageProtection); |
| 837 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 854 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 838 }; | 855 }; |
| 839 | 856 |
| 840 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 857 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |