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

Side by Side Diff: extensions/renderer/script_injection_manager.h

Issue 1899083003: Convert //extensions/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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_RENDERER_SCRIPT_INJECTION_MANAGER_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 private: 47 private:
48 // A RenderFrameObserver implementation which watches the various render 48 // A RenderFrameObserver implementation which watches the various render
49 // frames in order to notify the ScriptInjectionManager of different 49 // frames in order to notify the ScriptInjectionManager of different
50 // document load states and IPCs. 50 // document load states and IPCs.
51 class RFOHelper; 51 class RFOHelper;
52 52
53 using FrameStatusMap = 53 using FrameStatusMap =
54 std::map<content::RenderFrame*, UserScript::RunLocation>; 54 std::map<content::RenderFrame*, UserScript::RunLocation>;
55 55
56 using ScriptInjectionVector = std::vector<scoped_ptr<ScriptInjection>>; 56 using ScriptInjectionVector = std::vector<std::unique_ptr<ScriptInjection>>;
57 57
58 // Notifies that an injection has been finished. 58 // Notifies that an injection has been finished.
59 void OnInjectionFinished(ScriptInjection* injection); 59 void OnInjectionFinished(ScriptInjection* injection);
60 60
61 // UserScriptSetManager::Observer implementation. 61 // UserScriptSetManager::Observer implementation.
62 void OnUserScriptsUpdated(const std::set<HostID>& changed_hosts, 62 void OnUserScriptsUpdated(const std::set<HostID>& changed_hosts,
63 const std::vector<UserScript*>& scripts) override; 63 const std::vector<UserScript*>& scripts) override;
64 64
65 // Notifies that an RFOHelper should be removed. 65 // Notifies that an RFOHelper should be removed.
66 void RemoveObserver(RFOHelper* helper); 66 void RemoveObserver(RFOHelper* helper);
67 67
68 // Invalidate any pending tasks associated with |frame|. 68 // Invalidate any pending tasks associated with |frame|.
69 void InvalidateForFrame(content::RenderFrame* frame); 69 void InvalidateForFrame(content::RenderFrame* frame);
70 70
71 // Starts the process to inject appropriate scripts into |frame|. 71 // Starts the process to inject appropriate scripts into |frame|.
72 void StartInjectScripts(content::RenderFrame* frame, 72 void StartInjectScripts(content::RenderFrame* frame,
73 UserScript::RunLocation run_location); 73 UserScript::RunLocation run_location);
74 74
75 // Actually injects the scripts into |frame|. 75 // Actually injects the scripts into |frame|.
76 void InjectScripts(content::RenderFrame* frame, 76 void InjectScripts(content::RenderFrame* frame,
77 UserScript::RunLocation run_location); 77 UserScript::RunLocation run_location);
78 78
79 // Try to inject and store injection if it has not finished. 79 // Try to inject and store injection if it has not finished.
80 void TryToInject(scoped_ptr<ScriptInjection> injection, 80 void TryToInject(std::unique_ptr<ScriptInjection> injection,
81 UserScript::RunLocation run_location, 81 UserScript::RunLocation run_location,
82 ScriptsRunInfo* scripts_run_info); 82 ScriptsRunInfo* scripts_run_info);
83 83
84 // Handle the ExecuteCode extension message. 84 // Handle the ExecuteCode extension message.
85 void HandleExecuteCode(const ExtensionMsg_ExecuteCode_Params& params, 85 void HandleExecuteCode(const ExtensionMsg_ExecuteCode_Params& params,
86 content::RenderFrame* render_frame); 86 content::RenderFrame* render_frame);
87 87
88 // Handle the ExecuteDeclarativeScript extension message. 88 // Handle the ExecuteDeclarativeScript extension message.
89 void HandleExecuteDeclarativeScript(content::RenderFrame* web_frame, 89 void HandleExecuteDeclarativeScript(content::RenderFrame* web_frame,
90 int tab_id, 90 int tab_id,
91 const ExtensionId& extension_id, 91 const ExtensionId& extension_id,
92 int script_id, 92 int script_id,
93 const GURL& url); 93 const GURL& url);
94 94
95 // Handle the GrantInjectionPermission extension message. 95 // Handle the GrantInjectionPermission extension message.
96 void HandlePermitScriptInjection(int64_t request_id); 96 void HandlePermitScriptInjection(int64_t request_id);
97 97
98 // The map of active web frames to their corresponding statuses. The 98 // The map of active web frames to their corresponding statuses. The
99 // RunLocation of the frame corresponds to the last location that has ran. 99 // RunLocation of the frame corresponds to the last location that has ran.
100 FrameStatusMap frame_statuses_; 100 FrameStatusMap frame_statuses_;
101 101
102 // The frames currently being injected into, so long as that frame is valid. 102 // The frames currently being injected into, so long as that frame is valid.
103 std::set<content::RenderFrame*> active_injection_frames_; 103 std::set<content::RenderFrame*> active_injection_frames_;
104 104
105 // The collection of RFOHelpers. 105 // The collection of RFOHelpers.
106 std::vector<scoped_ptr<RFOHelper>> rfo_helpers_; 106 std::vector<std::unique_ptr<RFOHelper>> rfo_helpers_;
107 107
108 // The set of UserScripts associated with extensions. Owned by the Dispatcher. 108 // The set of UserScripts associated with extensions. Owned by the Dispatcher.
109 UserScriptSetManager* user_script_set_manager_; 109 UserScriptSetManager* user_script_set_manager_;
110 110
111 // Pending injections which are waiting for either the proper run location or 111 // Pending injections which are waiting for either the proper run location or
112 // user consent. 112 // user consent.
113 ScriptInjectionVector pending_injections_; 113 ScriptInjectionVector pending_injections_;
114 114
115 // Running injections which are waiting for async callbacks from blink. 115 // Running injections which are waiting for async callbacks from blink.
116 ScriptInjectionVector running_injections_; 116 ScriptInjectionVector running_injections_;
117 117
118 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> 118 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer>
119 user_script_set_manager_observer_; 119 user_script_set_manager_observer_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager); 121 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionManager);
122 }; 122 };
123 123
124 } // namespace extensions 124 } // namespace extensions
125 125
126 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_ 126 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | extensions/renderer/script_injection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698