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

Side by Side Diff: extensions/browser/user_script_loader.h

Issue 2892353002: WebUI: Fix crash while loading scripts for webview.[add/remove]ContentScripts API. (Closed)
Patch Set: Remove test and add TODO Created 3 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
« no previous file with comments | « no previous file | extensions/browser/web_ui_user_script_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_ 5 #ifndef EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_
6 #define EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_ 6 #define EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // Pickle user scripts and return pointer to the shared memory. 89 // Pickle user scripts and return pointer to the shared memory.
90 static std::unique_ptr<base::SharedMemory> Serialize( 90 static std::unique_ptr<base::SharedMemory> Serialize(
91 const extensions::UserScriptList& scripts); 91 const extensions::UserScriptList& scripts);
92 92
93 // Adds or removes observers. 93 // Adds or removes observers.
94 void AddObserver(Observer* observer); 94 void AddObserver(Observer* observer);
95 void RemoveObserver(Observer* observer); 95 void RemoveObserver(Observer* observer);
96 96
97 protected: 97 protected:
98 // Allows the derived classes have different ways to load user scripts. 98 // Allows the derived classes to have different ways to load user scripts.
99 // This may not be synchronous with the calls to Add/Remove/Clear scripts.
99 virtual void LoadScripts(std::unique_ptr<UserScriptList> user_scripts, 100 virtual void LoadScripts(std::unique_ptr<UserScriptList> user_scripts,
100 const std::set<HostID>& changed_hosts, 101 const std::set<HostID>& changed_hosts,
101 const std::set<int>& added_script_ids, 102 const std::set<int>& added_script_ids,
102 LoadScriptsCallback callback) = 0; 103 LoadScriptsCallback callback) = 0;
103 104
104 // Sets the flag if the initial set of hosts has finished loading; if it's 105 // Sets the flag if the initial set of hosts has finished loading; if it's
105 // set to be true, calls AttempLoad() to bootstrap. 106 // set to be true, calls AttempLoad() to bootstrap.
106 void SetReady(bool ready); 107 void SetReady(bool ready);
107 108
108 content::BrowserContext* browser_context() const { return browser_context_; } 109 content::BrowserContext* browser_context() const { return browser_context_; }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 base::ObserverList<Observer> observers_; 182 base::ObserverList<Observer> observers_;
182 183
183 base::WeakPtrFactory<UserScriptLoader> weak_factory_; 184 base::WeakPtrFactory<UserScriptLoader> weak_factory_;
184 185
185 DISALLOW_COPY_AND_ASSIGN(UserScriptLoader); 186 DISALLOW_COPY_AND_ASSIGN(UserScriptLoader);
186 }; 187 };
187 188
188 } // namespace extensions 189 } // namespace extensions
189 190
190 #endif // EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_ 191 #endif // EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/web_ui_user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698