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

Side by Side Diff: extensions/renderer/user_script_set.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
« no previous file with comments | « extensions/renderer/user_script_injector.cc ('k') | extensions/renderer/user_script_set.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_RENDERER_USER_SCRIPT_SET_H_ 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
7 7
8 #include <memory>
8 #include <set> 9 #include <set>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "extensions/common/user_script.h" 17 #include "extensions/common/user_script.h"
18 18
19 class GURL; 19 class GURL;
20 20
21 namespace content { 21 namespace content {
22 class RenderFrame; 22 class RenderFrame;
23 } 23 }
(...skipping 20 matching lines...) Expand all
44 void AddObserver(Observer* observer); 44 void AddObserver(Observer* observer);
45 void RemoveObserver(Observer* observer); 45 void RemoveObserver(Observer* observer);
46 46
47 // Appends the ids of the extensions that have user scripts to |ids|. 47 // Appends the ids of the extensions that have user scripts to |ids|.
48 void GetActiveExtensionIds(std::set<std::string>* ids) const; 48 void GetActiveExtensionIds(std::set<std::string>* ids) const;
49 49
50 // Append any ScriptInjections that should run on the given |render_frame| and 50 // Append any ScriptInjections that should run on the given |render_frame| and
51 // |tab_id|, at the given |run_location|, to |injections|. 51 // |tab_id|, at the given |run_location|, to |injections|.
52 // |extensions| is passed in to verify the corresponding extension is still 52 // |extensions| is passed in to verify the corresponding extension is still
53 // valid. 53 // valid.
54 void GetInjections(std::vector<scoped_ptr<ScriptInjection>>* injections, 54 void GetInjections(std::vector<std::unique_ptr<ScriptInjection>>* injections,
55 content::RenderFrame* render_frame, 55 content::RenderFrame* render_frame,
56 int tab_id, 56 int tab_id,
57 UserScript::RunLocation run_location); 57 UserScript::RunLocation run_location);
58 58
59 scoped_ptr<ScriptInjection> GetDeclarativeScriptInjection( 59 std::unique_ptr<ScriptInjection> GetDeclarativeScriptInjection(
60 int script_id, 60 int script_id,
61 content::RenderFrame* render_frame, 61 content::RenderFrame* render_frame,
62 int tab_id, 62 int tab_id,
63 UserScript::RunLocation run_location, 63 UserScript::RunLocation run_location,
64 const GURL& document_url); 64 const GURL& document_url);
65 65
66 // Updates scripts given the shared memory region containing user scripts. 66 // Updates scripts given the shared memory region containing user scripts.
67 // Returns true if the scripts were successfully updated. 67 // Returns true if the scripts were successfully updated.
68 bool UpdateUserScripts(base::SharedMemoryHandle shared_memory, 68 bool UpdateUserScripts(base::SharedMemoryHandle shared_memory,
69 const std::set<HostID>& changed_hosts, 69 const std::set<HostID>& changed_hosts,
70 bool whitelisted_only); 70 bool whitelisted_only);
71 71
72 const std::vector<UserScript*>& scripts() const { return scripts_.get(); } 72 const std::vector<UserScript*>& scripts() const { return scripts_.get(); }
73 73
74 private: 74 private:
75 // Returns a new ScriptInjection for the given |script| to execute in the 75 // Returns a new ScriptInjection for the given |script| to execute in the
76 // |render_frame|, or NULL if the script should not execute. 76 // |render_frame|, or NULL if the script should not execute.
77 scoped_ptr<ScriptInjection> GetInjectionForScript( 77 std::unique_ptr<ScriptInjection> GetInjectionForScript(
78 const UserScript* script, 78 const UserScript* script,
79 content::RenderFrame* render_frame, 79 content::RenderFrame* render_frame,
80 int tab_id, 80 int tab_id,
81 UserScript::RunLocation run_location, 81 UserScript::RunLocation run_location,
82 const GURL& document_url, 82 const GURL& document_url,
83 bool is_declarative); 83 bool is_declarative);
84 84
85 // Shared memory containing raw script data. 85 // Shared memory containing raw script data.
86 scoped_ptr<base::SharedMemory> shared_memory_; 86 std::unique_ptr<base::SharedMemory> shared_memory_;
87 87
88 // The UserScripts this injector manages. 88 // The UserScripts this injector manages.
89 ScopedVector<UserScript> scripts_; 89 ScopedVector<UserScript> scripts_;
90 90
91 // The associated observers. 91 // The associated observers.
92 base::ObserverList<Observer> observers_; 92 base::ObserverList<Observer> observers_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(UserScriptSet); 94 DISALLOW_COPY_AND_ASSIGN(UserScriptSet);
95 }; 95 };
96 96
97 } // namespace extensions 97 } // namespace extensions
98 98
99 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ 99 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
OLDNEW
« no previous file with comments | « extensions/renderer/user_script_injector.cc ('k') | extensions/renderer/user_script_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698