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

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

Issue 288053002: Block content scripts from executing until user grants permission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after ScriptInjection refactor 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 (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_USER_SCRIPT_MASTER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const content::NotificationDetails& details) OVERRIDE; 142 const content::NotificationDetails& details) OVERRIDE;
143 143
144 // ExtensionRegistryObserver implementation. 144 // ExtensionRegistryObserver implementation.
145 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, 145 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
146 const Extension* extension) OVERRIDE; 146 const Extension* extension) OVERRIDE;
147 virtual void OnExtensionUnloaded( 147 virtual void OnExtensionUnloaded(
148 content::BrowserContext* browser_context, 148 content::BrowserContext* browser_context,
149 const Extension* extension, 149 const Extension* extension,
150 UnloadedExtensionInfo::Reason reason) OVERRIDE; 150 UnloadedExtensionInfo::Reason reason) OVERRIDE;
151 151
152 // Sends the renderer process a new set of user scripts. 152 // Sends the renderer process a new set of user scripts.
not at google - send to devlin 2014/05/21 15:01:07 you might want to add that |changed_extensions| is
Devlin 2014/05/21 17:05:11 Done.
153 void SendUpdate(content::RenderProcessHost* process, 153 void SendUpdate(content::RenderProcessHost* process,
154 base::SharedMemory* shared_memory); 154 base::SharedMemory* shared_memory,
155 const std::set<std::string>& changed_extensions);
155 156
156 // Manages our notification registrations. 157 // Manages our notification registrations.
157 content::NotificationRegistrar registrar_; 158 content::NotificationRegistrar registrar_;
158 159
159 // We hang on to our pointer to know if we've already got one running. 160 // We hang on to our pointer to know if we've already got one running.
160 scoped_refptr<ScriptReloader> script_reloader_; 161 scoped_refptr<ScriptReloader> script_reloader_;
161 162
162 // Contains the scripts that were found the last time scripts were updated. 163 // Contains the scripts that were found the last time scripts were updated.
163 scoped_ptr<base::SharedMemory> shared_memory_; 164 scoped_ptr<base::SharedMemory> shared_memory_;
164 165
165 // List of scripts from currently-installed extensions we should load. 166 // List of scripts from currently-installed extensions we should load.
166 UserScriptList user_scripts_; 167 UserScriptList user_scripts_;
167 168
168 // Maps extension info needed for localization to an extension ID. 169 // Maps extension info needed for localization to an extension ID.
169 ExtensionsInfo extensions_info_; 170 ExtensionsInfo extensions_info_;
170 171
172 // The IDs of the extensions which have changed since the last update sent to
173 // the renderer.
174 std::set<std::string> changed_extensions_;
175
171 // If the extensions service has finished loading its initial set of 176 // If the extensions service has finished loading its initial set of
172 // extensions. 177 // extensions.
173 bool extensions_service_ready_; 178 bool extensions_service_ready_;
174 179
175 // If list of user scripts is modified while we're loading it, we note 180 // If list of user scripts is modified while we're loading it, we note
176 // that we're currently mid-load and then start over again once the load 181 // that we're currently mid-load and then start over again once the load
177 // finishes. This boolean tracks whether another load is pending. 182 // finishes. This boolean tracks whether another load is pending.
178 bool pending_load_; 183 bool pending_load_;
179 184
180 // The profile for which the scripts managed here are installed. 185 // The profile for which the scripts managed here are installed.
181 Profile* profile_; 186 Profile* profile_;
182 187
183 // Listen to extension load, unloaded notifications. 188 // Listen to extension load, unloaded notifications.
184 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 189 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
185 extension_registry_observer_; 190 extension_registry_observer_;
186 191
187 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); 192 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster);
188 }; 193 };
189 194
190 } // namespace extensions 195 } // namespace extensions
191 196
192 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ 197 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698