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

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

Issue 266963003: Beginning of support for extension content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, forgot to upload minor cosmetic changes to test Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SYSTEM_IMPL_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
7 7
8 #include "extensions/browser/content_verifier.h"
8 #include "extensions/browser/extension_system.h" 9 #include "extensions/browser/extension_system.h"
9 #include "extensions/common/one_shot_event.h" 10 #include "extensions/common/one_shot_event.h"
10 11
11 class Profile; 12 class Profile;
12 13
13 namespace extensions { 14 namespace extensions {
14 15
16 class ContentVerifier;
15 class ExtensionSystemSharedFactory; 17 class ExtensionSystemSharedFactory;
16 class ExtensionWarningBadgeService; 18 class ExtensionWarningBadgeService;
17 class NavigationObserver; 19 class NavigationObserver;
18 class StandardManagementPolicyProvider; 20 class StandardManagementPolicyProvider;
19 21
20 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. 22 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl.
21 // Implementation details: non-shared services are owned by 23 // Implementation details: non-shared services are owned by
22 // ExtensionSystemImpl, a KeyedService with separate incognito 24 // ExtensionSystemImpl, a KeyedService with separate incognito
23 // instances. A private Shared class (also a KeyedService, 25 // instances. A private Shared class (also a KeyedService,
24 // but with a shared instance for incognito) keeps the common services. 26 // but with a shared instance for incognito) keeps the common services.
(...skipping 25 matching lines...) Expand all
50 virtual QuotaService* quota_service() OVERRIDE; // shared 52 virtual QuotaService* quota_service() OVERRIDE; // shared
51 53
52 virtual void RegisterExtensionWithRequestContexts( 54 virtual void RegisterExtensionWithRequestContexts(
53 const Extension* extension) OVERRIDE; 55 const Extension* extension) OVERRIDE;
54 56
55 virtual void UnregisterExtensionWithRequestContexts( 57 virtual void UnregisterExtensionWithRequestContexts(
56 const std::string& extension_id, 58 const std::string& extension_id,
57 const UnloadedExtensionInfo::Reason reason) OVERRIDE; 59 const UnloadedExtensionInfo::Reason reason) OVERRIDE;
58 60
59 virtual const OneShotEvent& ready() const OVERRIDE; 61 virtual const OneShotEvent& ready() const OVERRIDE;
62 virtual ContentVerifier* content_verifier() OVERRIDE; // shared
60 63
61 private: 64 private:
62 friend class ExtensionSystemSharedFactory; 65 friend class ExtensionSystemSharedFactory;
63 66
64 // Owns the Extension-related systems that have a single instance 67 // Owns the Extension-related systems that have a single instance
65 // shared between normal and incognito profiles. 68 // shared between normal and incognito profiles.
66 class Shared : public KeyedService { 69 class Shared : public KeyedService, public ContentVerifierObserver {
67 public: 70 public:
68 explicit Shared(Profile* profile); 71 explicit Shared(Profile* profile);
69 virtual ~Shared(); 72 virtual ~Shared();
70 73
71 // Initialization takes place in phases. 74 // Initialization takes place in phases.
72 virtual void InitPrefs(); 75 virtual void InitPrefs();
73 // This must not be called until all the providers have been created. 76 // This must not be called until all the providers have been created.
74 void RegisterManagementPolicyProviders(); 77 void RegisterManagementPolicyProviders();
75 void Init(bool extensions_enabled); 78 void Init(bool extensions_enabled);
76 79
77 // KeyedService implementation. 80 // KeyedService implementation.
78 virtual void Shutdown() OVERRIDE; 81 virtual void Shutdown() OVERRIDE;
79 82
83 // ContentVerifierObserver implementation.
84 virtual void ContentVerifyFailed(const std::string& extension_id) OVERRIDE;
85
80 StateStore* state_store(); 86 StateStore* state_store();
81 StateStore* rules_store(); 87 StateStore* rules_store();
82 ExtensionService* extension_service(); 88 ExtensionService* extension_service();
83 RuntimeData* runtime_data(); 89 RuntimeData* runtime_data();
84 ManagementPolicy* management_policy(); 90 ManagementPolicy* management_policy();
85 UserScriptMaster* user_script_master(); 91 UserScriptMaster* user_script_master();
86 Blacklist* blacklist(); 92 Blacklist* blacklist();
87 InfoMap* info_map(); 93 InfoMap* info_map();
88 LazyBackgroundTaskQueue* lazy_background_task_queue(); 94 LazyBackgroundTaskQueue* lazy_background_task_queue();
89 EventRouter* event_router(); 95 EventRouter* event_router();
90 ExtensionWarningService* warning_service(); 96 ExtensionWarningService* warning_service();
91 ErrorConsole* error_console(); 97 ErrorConsole* error_console();
92 InstallVerifier* install_verifier(); 98 InstallVerifier* install_verifier();
93 QuotaService* quota_service(); 99 QuotaService* quota_service();
94 const OneShotEvent& ready() const { return ready_; } 100 const OneShotEvent& ready() const { return ready_; }
101 ContentVerifier* content_verifier();
95 102
96 private: 103 private:
97 Profile* profile_; 104 Profile* profile_;
98 105
99 // The services that are shared between normal and incognito profiles. 106 // The services that are shared between normal and incognito profiles.
100 107
101 scoped_ptr<StateStore> state_store_; 108 scoped_ptr<StateStore> state_store_;
102 scoped_ptr<StateStore> rules_store_; 109 scoped_ptr<StateStore> rules_store_;
103 // LazyBackgroundTaskQueue is a dependency of 110 // LazyBackgroundTaskQueue is a dependency of
104 // MessageService and EventRouter. 111 // MessageService and EventRouter.
(...skipping 10 matching lines...) Expand all
115 scoped_ptr<ExtensionService> extension_service_; 122 scoped_ptr<ExtensionService> extension_service_;
116 scoped_ptr<ManagementPolicy> management_policy_; 123 scoped_ptr<ManagementPolicy> management_policy_;
117 // extension_info_map_ needs to outlive process_manager_. 124 // extension_info_map_ needs to outlive process_manager_.
118 scoped_refptr<InfoMap> extension_info_map_; 125 scoped_refptr<InfoMap> extension_info_map_;
119 scoped_ptr<ExtensionWarningService> extension_warning_service_; 126 scoped_ptr<ExtensionWarningService> extension_warning_service_;
120 scoped_ptr<ExtensionWarningBadgeService> extension_warning_badge_service_; 127 scoped_ptr<ExtensionWarningBadgeService> extension_warning_badge_service_;
121 scoped_ptr<ErrorConsole> error_console_; 128 scoped_ptr<ErrorConsole> error_console_;
122 scoped_ptr<InstallVerifier> install_verifier_; 129 scoped_ptr<InstallVerifier> install_verifier_;
123 scoped_ptr<QuotaService> quota_service_; 130 scoped_ptr<QuotaService> quota_service_;
124 131
132 // For verifying the contents of extensions read from disk.
133 scoped_refptr<ContentVerifier> content_verifier_;
134
125 #if defined(OS_CHROMEOS) 135 #if defined(OS_CHROMEOS)
126 scoped_ptr<chromeos::DeviceLocalAccountManagementPolicyProvider> 136 scoped_ptr<chromeos::DeviceLocalAccountManagementPolicyProvider>
127 device_local_account_management_policy_provider_; 137 device_local_account_management_policy_provider_;
128 #endif 138 #endif
129 139
130 OneShotEvent ready_; 140 OneShotEvent ready_;
131 }; 141 };
132 142
133 Profile* profile_; 143 Profile* profile_;
134 144
135 Shared* shared_; 145 Shared* shared_;
136 146
137 // |process_manager_| must be destroyed before the Profile's |io_data_|. While 147 // |process_manager_| must be destroyed before the Profile's |io_data_|. While
138 // |process_manager_| still lives, we handle incoming resource requests from 148 // |process_manager_| still lives, we handle incoming resource requests from
139 // extension processes and those require access to the ResourceContext owned 149 // extension processes and those require access to the ResourceContext owned
140 // by |io_data_|. 150 // by |io_data_|.
141 scoped_ptr<ProcessManager> process_manager_; 151 scoped_ptr<ProcessManager> process_manager_;
142 152
143 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); 153 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl);
144 }; 154 };
145 155
146 } // namespace extensions 156 } // namespace extensions
147 157
148 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ 158 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698