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

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

Issue 2227193002: Make UserScript non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 years, 4 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
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_DECLARATIVE_USER_SCRIPT_MASTER_H_ 5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
(...skipping 17 matching lines...) Expand all
28 // operations are delegated, and provides an interface for adding, removing, 28 // operations are delegated, and provides an interface for adding, removing,
29 // and clearing scripts. 29 // and clearing scripts.
30 class DeclarativeUserScriptMaster { 30 class DeclarativeUserScriptMaster {
31 public: 31 public:
32 DeclarativeUserScriptMaster(content::BrowserContext* browser_context, 32 DeclarativeUserScriptMaster(content::BrowserContext* browser_context,
33 const HostID& host_id); 33 const HostID& host_id);
34 ~DeclarativeUserScriptMaster(); 34 ~DeclarativeUserScriptMaster();
35 35
36 // Adds script to shared memory region. This may not happen right away if a 36 // Adds script to shared memory region. This may not happen right away if a
37 // script load is in progress. 37 // script load is in progress.
38 void AddScript(const UserScript& script); 38 void AddScript(std::unique_ptr<UserScript> script);
39 39
40 // Adds a set of scripts to shared meomory region. The fetch of the content 40 // Adds a set of scripts to shared meomory region. The fetch of the content
41 // of the script on WebUI requires to start URL request to the associated 41 // of the script on WebUI requires to start URL request to the associated
42 // render specified by |render_process_id, render_frame_id|. 42 // render specified by |render_process_id, render_frame_id|.
43 // This may not happen right away if a script load is in progress. 43 // This may not happen right away if a script load is in progress.
44 void AddScripts(const std::vector<UserScript>& scripts, 44 void AddScripts(
45 int render_process_id, 45 std::unique_ptr<std::vector<std::unique_ptr<UserScript>>> scripts,
46 int render_frame_id); 46 int render_process_id,
47 int render_frame_id);
47 48
48 // Removes script from shared memory region. This may not happen right away if 49 // Removes script from shared memory region. This may not happen right away if
49 // a script load is in progress. 50 // a script load is in progress.
50 void RemoveScript(const UserScript& script); 51 void RemoveScript(const UserScriptIDPair& script);
51 52
52 // Removes a set of scripts from shared memory region. This may not happen 53 // Removes a set of scripts from shared memory region. This may not happen
53 // right away if a script load is in progress. 54 // right away if a script load is in progress.
54 void RemoveScripts(const std::set<UserScriptIDPair>& scripts); 55 void RemoveScripts(const std::set<UserScriptIDPair>& scripts);
55 56
56 // Removes all scripts from shared memory region. This may not happen right 57 // Removes all scripts from shared memory region. This may not happen right
57 // away if a script load is in progress. 58 // away if a script load is in progress.
58 void ClearScripts(); 59 void ClearScripts();
59 60
60 const HostID& host_id() const { return host_id_; } 61 const HostID& host_id() const { return host_id_; }
61 62
62 UserScriptLoader* loader() { return loader_.get(); } 63 UserScriptLoader* loader() { return loader_.get(); }
63 64
64 private: 65 private:
65 // ID of host that owns scripts that this component manages. 66 // ID of host that owns scripts that this component manages.
66 HostID host_id_; 67 HostID host_id_;
67 68
68 // Script loader that handles loading contents of scripts into shared memory 69 // Script loader that handles loading contents of scripts into shared memory
69 // and notifying renderers of script updates. 70 // and notifying renderers of script updates.
70 std::unique_ptr<UserScriptLoader> loader_; 71 std::unique_ptr<UserScriptLoader> loader_;
71 72
72 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); 73 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster);
73 }; 74 };
74 75
75 } // namespace extensions 76 } // namespace extensions
76 77
77 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ 78 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698