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

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

Issue 2213603002: Prevent duplicate content script injection defined in manifest.json (reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test added 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_RENDERER_USER_SCRIPT_INJECTOR_H_ 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_
6 #define EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_ 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 // UserScriptSet::Observer implementation. 35 // UserScriptSet::Observer implementation.
36 void OnUserScriptsUpdated( 36 void OnUserScriptsUpdated(
37 const std::set<HostID>& changed_hosts, 37 const std::set<HostID>& changed_hosts,
38 const std::vector<std::unique_ptr<UserScript>>& scripts) override; 38 const std::vector<std::unique_ptr<UserScript>>& scripts) override;
39 39
40 // ScriptInjector implementation. 40 // ScriptInjector implementation.
41 UserScript::InjectionType script_type() const override; 41 UserScript::InjectionType script_type() const override;
42 bool ShouldExecuteInMainWorld() const override; 42 bool ShouldExecuteInMainWorld() const override;
43 bool IsUserGesture() const override; 43 bool IsUserGesture() const override;
44 bool ExpectsResults() const override; 44 bool ExpectsResults() const override;
45 bool ShouldInjectJs(UserScript::RunLocation run_location) const override; 45 bool ShouldInjectJs(UserScript::RunLocation run_location,
46 bool ShouldInjectCss(UserScript::RunLocation run_location) const override; 46 std::set<GURL> injected_scripts) const override;
47 bool ShouldInjectCss(UserScript::RunLocation run_location,
48 std::set<GURL> injected_scripts) const override;
47 PermissionsData::AccessType CanExecuteOnFrame( 49 PermissionsData::AccessType CanExecuteOnFrame(
48 const InjectionHost* injection_host, 50 const InjectionHost* injection_host,
49 blink::WebLocalFrame* web_frame, 51 blink::WebLocalFrame* web_frame,
50 int tab_id) const override; 52 int tab_id) const override;
51 std::vector<blink::WebScriptSource> GetJsSources( 53 std::vector<blink::WebScriptSource> GetJsSources(
52 UserScript::RunLocation run_location) const override; 54 UserScript::RunLocation run_location,
55 ScriptsRunInfo* scripts_run_info) const override;
53 std::vector<std::string> GetCssSources( 56 std::vector<std::string> GetCssSources(
54 UserScript::RunLocation run_location) const override; 57 UserScript::RunLocation run_location,
58 ScriptsRunInfo* scripts_run_info) const override;
55 void GetRunInfo(ScriptsRunInfo* scripts_run_info, 59 void GetRunInfo(ScriptsRunInfo* scripts_run_info,
56 UserScript::RunLocation run_location) const override; 60 UserScript::RunLocation run_location) const override;
57 void OnInjectionComplete(std::unique_ptr<base::Value> execution_result, 61 void OnInjectionComplete(std::unique_ptr<base::Value> execution_result,
58 UserScript::RunLocation run_location, 62 UserScript::RunLocation run_location,
59 content::RenderFrame* render_frame) override; 63 content::RenderFrame* render_frame) override;
60 void OnWillNotInject(InjectFailureReason reason, 64 void OnWillNotInject(InjectFailureReason reason,
61 content::RenderFrame* render_frame) override; 65 content::RenderFrame* render_frame) override;
62 66
63 // The associated user script. Owned by the UserScriptInjector that created 67 // The associated user script. Owned by the UserScriptInjector that created
64 // this object. 68 // this object.
(...skipping 13 matching lines...) Expand all
78 82
79 ScopedObserver<UserScriptSet, UserScriptSet::Observer> 83 ScopedObserver<UserScriptSet, UserScriptSet::Observer>
80 user_script_set_observer_; 84 user_script_set_observer_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(UserScriptInjector); 86 DISALLOW_COPY_AND_ASSIGN(UserScriptInjector);
83 }; 87 };
84 88
85 } // namespace extensions 89 } // namespace extensions
86 90
87 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_ 91 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698