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

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

Issue 102103005: Move c/c/e/extension_set to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/prefs/pref_change_registrar.h" 19 #include "base/prefs/pref_change_registrar.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "chrome/browser/extensions/blacklist.h" 21 #include "chrome/browser/extensions/blacklist.h"
22 #include "chrome/browser/extensions/extension_function_histogram_value.h" 22 #include "chrome/browser/extensions/extension_function_histogram_value.h"
23 #include "chrome/browser/extensions/extension_prefs.h" 23 #include "chrome/browser/extensions/extension_prefs.h"
24 #include "chrome/browser/extensions/extension_sync_service.h" 24 #include "chrome/browser/extensions/extension_sync_service.h"
25 #include "chrome/common/extensions/extension_constants.h" 25 #include "chrome/common/extensions/extension_constants.h"
26 #include "chrome/common/extensions/extension_set.h"
27 #include "content/public/browser/devtools_agent_host.h" 26 #include "content/public/browser/devtools_agent_host.h"
28 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
30 #include "extensions/browser/external_provider_interface.h" 29 #include "extensions/browser/external_provider_interface.h"
31 #include "extensions/browser/management_policy.h" 30 #include "extensions/browser/management_policy.h"
32 #include "extensions/browser/pending_extension_manager.h" 31 #include "extensions/browser/pending_extension_manager.h"
33 #include "extensions/browser/process_manager.h" 32 #include "extensions/browser/process_manager.h"
34 #include "extensions/browser/process_map.h" 33 #include "extensions/browser/process_map.h"
35 #include "extensions/browser/quota_service.h" 34 #include "extensions/browser/quota_service.h"
36 #include "extensions/common/extension.h" 35 #include "extensions/common/extension.h"
36 #include "extensions/common/extension_set.h"
37 #include "extensions/common/manifest.h" 37 #include "extensions/common/manifest.h"
38 #include "extensions/common/manifest_handlers/shared_module_info.h" 38 #include "extensions/common/manifest_handlers/shared_module_info.h"
39 #include "extensions/common/one_shot_event.h" 39 #include "extensions/common/one_shot_event.h"
40 40
41 class CommandLine; 41 class CommandLine;
42 class ExtensionErrorUI; 42 class ExtensionErrorUI;
43 class ExtensionToolbarModel; 43 class ExtensionToolbarModel;
44 class GURL; 44 class GURL;
45 class Profile; 45 class Profile;
46 46
(...skipping 18 matching lines...) Expand all
65 namespace syncer { 65 namespace syncer {
66 class SyncErrorFactory; 66 class SyncErrorFactory;
67 } 67 }
68 68
69 // This is an interface class to encapsulate the dependencies that 69 // This is an interface class to encapsulate the dependencies that
70 // various classes have on ExtensionService. This allows easy mocking. 70 // various classes have on ExtensionService. This allows easy mocking.
71 class ExtensionServiceInterface 71 class ExtensionServiceInterface
72 : public base::SupportsWeakPtr<ExtensionServiceInterface> { 72 : public base::SupportsWeakPtr<ExtensionServiceInterface> {
73 public: 73 public:
74 virtual ~ExtensionServiceInterface() {} 74 virtual ~ExtensionServiceInterface() {}
75 virtual const ExtensionSet* extensions() const = 0; 75 virtual const extensions::ExtensionSet* extensions() const = 0;
76 virtual const ExtensionSet* disabled_extensions() const = 0; 76 virtual const extensions::ExtensionSet* disabled_extensions() const = 0;
77 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0; 77 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0;
78 78
79 // Install an update. Return true if the install can be started. 79 // Install an update. Return true if the install can be started.
80 // Set out_crx_installer to the installer if one was started. 80 // Set out_crx_installer to the installer if one was started.
81 virtual bool UpdateExtension( 81 virtual bool UpdateExtension(
82 const std::string& id, 82 const std::string& id,
83 const base::FilePath& path, 83 const base::FilePath& path,
84 const GURL& download_url, 84 const GURL& download_url,
85 extensions::CrxInstaller** out_crx_installer) = 0; 85 extensions::CrxInstaller** out_crx_installer) = 0;
86 virtual const extensions::Extension* GetExtensionById( 86 virtual const extensions::Extension* GetExtensionById(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const base::FilePath& install_directory, 151 const base::FilePath& install_directory,
152 extensions::ExtensionPrefs* extension_prefs, 152 extensions::ExtensionPrefs* extension_prefs,
153 extensions::Blacklist* blacklist, 153 extensions::Blacklist* blacklist,
154 bool autoupdate_enabled, 154 bool autoupdate_enabled,
155 bool extensions_enabled, 155 bool extensions_enabled,
156 extensions::OneShotEvent* ready); 156 extensions::OneShotEvent* ready);
157 157
158 virtual ~ExtensionService(); 158 virtual ~ExtensionService();
159 159
160 // Gets the list of currently installed extensions. 160 // Gets the list of currently installed extensions.
161 virtual const ExtensionSet* extensions() const OVERRIDE; 161 virtual const extensions::ExtensionSet* extensions() const OVERRIDE;
162 virtual const ExtensionSet* disabled_extensions() const OVERRIDE; 162 virtual const extensions::ExtensionSet* disabled_extensions() const OVERRIDE;
163 const ExtensionSet* terminated_extensions() const; 163 const extensions::ExtensionSet* terminated_extensions() const;
164 const ExtensionSet* blacklisted_extensions() const; 164 const extensions::ExtensionSet* blacklisted_extensions() const;
165 const ExtensionSet* delayed_installs() const; 165 const extensions::ExtensionSet* delayed_installs() const;
166 166
167 // Returns a set of all installed, disabled, blacklisted, and terminated 167 // Returns a set of all installed, disabled, blacklisted, and terminated
168 // extensions. 168 // extensions.
169 scoped_ptr<ExtensionSet> GenerateInstalledExtensionsSet() const; 169 scoped_ptr<extensions::ExtensionSet> GenerateInstalledExtensionsSet() const;
170 170
171 // Gets the object managing the set of pending extensions. 171 // Gets the object managing the set of pending extensions.
172 virtual extensions::PendingExtensionManager* 172 virtual extensions::PendingExtensionManager*
173 pending_extension_manager() OVERRIDE; 173 pending_extension_manager() OVERRIDE;
174 174
175 const base::FilePath& install_directory() const { return install_directory_; } 175 const base::FilePath& install_directory() const { return install_directory_; }
176 176
177 extensions::ProcessMap* process_map() { return &process_map_; } 177 extensions::ProcessMap* process_map() { return &process_map_; }
178 178
179 // Updates the app launcher value for the moved extension so that it is now 179 // Updates the app launcher value for the moved extension so that it is now
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 const extensions::Extension* extension, 362 const extensions::Extension* extension,
363 std::list<extensions::SharedModuleInfo::ImportInfo>* missing_modules, 363 std::list<extensions::SharedModuleInfo::ImportInfo>* missing_modules,
364 std::list<extensions::SharedModuleInfo::ImportInfo>* outdated_modules); 364 std::list<extensions::SharedModuleInfo::ImportInfo>* outdated_modules);
365 365
366 // Checks an extension's shared module imports to see if they are satisfied. 366 // Checks an extension's shared module imports to see if they are satisfied.
367 // If they are not, this function adds the dependencies to the pending install 367 // If they are not, this function adds the dependencies to the pending install
368 // list if |extension| came from the webstore. 368 // list if |extension| came from the webstore.
369 ImportStatus SatisfyImports(const extensions::Extension* extension); 369 ImportStatus SatisfyImports(const extensions::Extension* extension);
370 370
371 // Returns a set of extensions that import a given extension. 371 // Returns a set of extensions that import a given extension.
372 scoped_ptr<const ExtensionSet> GetDependentExtensions( 372 scoped_ptr<const extensions::ExtensionSet> GetDependentExtensions(
373 const extensions::Extension* extension); 373 const extensions::Extension* extension);
374 374
375 // Uninstalls shared modules that were only referenced by |extension|. 375 // Uninstalls shared modules that were only referenced by |extension|.
376 void PruneSharedModulesOnUninstall(const extensions::Extension* extension); 376 void PruneSharedModulesOnUninstall(const extensions::Extension* extension);
377 377
378 // Informs the service that an extension's files are in place for loading. 378 // Informs the service that an extension's files are in place for loading.
379 // 379 //
380 // |page_ordinal| is the location of the extension in the app launcher. 380 // |page_ordinal| is the location of the extension in the app launcher.
381 // |has_requirement_errors| is true if requirements of the extension weren't 381 // |has_requirement_errors| is true if requirements of the extension weren't
382 // met (for example graphics capabilities). 382 // met (for example graphics capabilities).
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 // Blacklist for the owning profile. 720 // Blacklist for the owning profile.
721 extensions::Blacklist* blacklist_; 721 extensions::Blacklist* blacklist_;
722 722
723 // Settings for the owning profile. 723 // Settings for the owning profile.
724 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 724 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
725 725
726 // The ExtensionSyncService that is used by this ExtensionService. 726 // The ExtensionSyncService that is used by this ExtensionService.
727 ExtensionSyncService* extension_sync_service_; 727 ExtensionSyncService* extension_sync_service_;
728 728
729 // The current list of installed extensions. 729 // The current list of installed extensions.
730 ExtensionSet extensions_; 730 extensions::ExtensionSet extensions_;
731 731
732 // The list of installed extensions that have been disabled. 732 // The list of installed extensions that have been disabled.
733 ExtensionSet disabled_extensions_; 733 extensions::ExtensionSet disabled_extensions_;
734 734
735 // The list of installed extensions that have been terminated. 735 // The list of installed extensions that have been terminated.
736 ExtensionSet terminated_extensions_; 736 extensions::ExtensionSet terminated_extensions_;
737 737
738 // The list of installed extensions that have been blacklisted. Generally 738 // The list of installed extensions that have been blacklisted. Generally
739 // these shouldn't be considered as installed by the extension platform: we 739 // these shouldn't be considered as installed by the extension platform: we
740 // only keep them around so that if extensions are blacklisted by mistake 740 // only keep them around so that if extensions are blacklisted by mistake
741 // they can easily be un-blacklisted. 741 // they can easily be un-blacklisted.
742 ExtensionSet blacklisted_extensions_; 742 extensions::ExtensionSet blacklisted_extensions_;
743 743
744 // The list of extension installs delayed for various reasons. The reason 744 // The list of extension installs delayed for various reasons. The reason
745 // for delayed install is stored in ExtensionPrefs. 745 // for delayed install is stored in ExtensionPrefs.
746 ExtensionSet delayed_installs_; 746 extensions::ExtensionSet delayed_installs_;
747 747
748 // Hold the set of pending extensions. 748 // Hold the set of pending extensions.
749 extensions::PendingExtensionManager pending_extension_manager_; 749 extensions::PendingExtensionManager pending_extension_manager_;
750 750
751 // The map of extension IDs to their runtime data. 751 // The map of extension IDs to their runtime data.
752 ExtensionRuntimeDataMap extension_runtime_data_; 752 ExtensionRuntimeDataMap extension_runtime_data_;
753 753
754 // The full path to the directory where extensions are installed. 754 // The full path to the directory where extensions are installed.
755 base::FilePath install_directory_; 755 base::FilePath install_directory_;
756 756
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 #endif 850 #endif
851 851
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
853 InstallAppsWithUnlimtedStorage); 853 InstallAppsWithUnlimtedStorage);
854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
855 InstallAppsAndCheckStorageProtection); 855 InstallAppsAndCheckStorageProtection);
856 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 856 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
857 }; 857 };
858 858
859 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 859 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_registry.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698