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

Side by Side Diff: extensions/renderer/programmatic_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: Addressed patch 6 code review comments Created 4 years, 3 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_PROGRAMMATIC_SCRIPT_INJECTOR_H_ 5 #ifndef EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_
6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ 6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 15 matching lines...) Expand all
26 ProgrammaticScriptInjector(const ExtensionMsg_ExecuteCode_Params& params, 26 ProgrammaticScriptInjector(const ExtensionMsg_ExecuteCode_Params& params,
27 content::RenderFrame* render_frame); 27 content::RenderFrame* render_frame);
28 ~ProgrammaticScriptInjector() override; 28 ~ProgrammaticScriptInjector() override;
29 29
30 private: 30 private:
31 // ScriptInjector implementation. 31 // ScriptInjector implementation.
32 UserScript::InjectionType script_type() const override; 32 UserScript::InjectionType script_type() const override;
33 bool ShouldExecuteInMainWorld() const override; 33 bool ShouldExecuteInMainWorld() const override;
34 bool IsUserGesture() const override; 34 bool IsUserGesture() const override;
35 bool ExpectsResults() const override; 35 bool ExpectsResults() const override;
36 bool ShouldInjectJs(UserScript::RunLocation run_location) const override; 36 bool ShouldInjectJs(UserScript::RunLocation run_location,
37 bool ShouldInjectCss(UserScript::RunLocation run_location) const override; 37 const std::set<GURL>& injected_scripts) const override;
38 bool ShouldInjectCss(UserScript::RunLocation run_location,
39 const std::set<GURL>& injected_scripts) const override;
38 PermissionsData::AccessType CanExecuteOnFrame( 40 PermissionsData::AccessType CanExecuteOnFrame(
39 const InjectionHost* injection_host, 41 const InjectionHost* injection_host,
40 blink::WebLocalFrame* web_frame, 42 blink::WebLocalFrame* web_frame,
41 int tab_id) const override; 43 int tab_id) const override;
42 std::vector<blink::WebScriptSource> GetJsSources( 44 std::vector<blink::WebScriptSource> GetJsSources(
43 UserScript::RunLocation run_location) const override; 45 UserScript::RunLocation run_location,
46 std::set<GURL>& injected_scripts) const override;
Devlin 2016/08/29 20:48:14 nit: chromium style (mostly) forbids non-const &s.
catmullings 2016/09/01 17:43:51 Done.
44 std::vector<blink::WebString> GetCssSources( 47 std::vector<blink::WebString> GetCssSources(
45 UserScript::RunLocation run_location) const override; 48 UserScript::RunLocation run_location,
49 std::set<GURL>& injected_scripts) const override;
46 void GetRunInfo(ScriptsRunInfo* scripts_run_info, 50 void GetRunInfo(ScriptsRunInfo* scripts_run_info,
47 UserScript::RunLocation run_location) const override; 51 UserScript::RunLocation run_location,
52 bool js_injection_completed,
53 bool should_inject_css) const override;
48 void OnInjectionComplete(std::unique_ptr<base::Value> execution_result, 54 void OnInjectionComplete(std::unique_ptr<base::Value> execution_result,
49 UserScript::RunLocation run_location, 55 UserScript::RunLocation run_location,
50 content::RenderFrame* render_frame) override; 56 content::RenderFrame* render_frame) override;
51 void OnWillNotInject(InjectFailureReason reason, 57 void OnWillNotInject(InjectFailureReason reason,
52 content::RenderFrame* render_frame) override; 58 content::RenderFrame* render_frame) override;
53 59
54 // Whether it is safe to include information about the URL in error messages. 60 // Whether it is safe to include information about the URL in error messages.
55 bool CanShowUrlInError() const; 61 bool CanShowUrlInError() const;
56 62
57 // Return the run location for this injector. 63 // Return the run location for this injector.
(...skipping 18 matching lines...) Expand all
76 82
77 // Whether or not this script injection has finished. 83 // Whether or not this script injection has finished.
78 bool finished_; 84 bool finished_;
79 85
80 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); 86 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector);
81 }; 87 };
82 88
83 } // namespace extensions 89 } // namespace extensions
84 90
85 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ 91 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698