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

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

Issue 885493007: Refactoring: de-couple Extensions from "script injection System" [render side] : 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Host::IsEmpty() and move ExtensionConsumer to extensions/renderer. Created 5 years, 10 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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "extensions/renderer/script_injection.h" 10 #include "extensions/renderer/script_injection.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 struct ExtensionMsg_ExecuteCode_Params; 13 struct ExtensionMsg_ExecuteCode_Params;
14 14
15 namespace blink { 15 namespace blink {
16 class WebFrame; 16 class WebFrame;
17 } 17 }
18 18
19 namespace content { 19 namespace content {
20 class RenderView; 20 class RenderView;
21 } 21 }
22 22
23 namespace extensions { 23 namespace extensions {
24 class Extension; 24 class Extension;
Devlin 2015/02/09 17:40:24 Shouldn't need this.
Xi Han 2015/02/09 23:28:11 Removed.
25 25
26 // A ScriptInjector to handle tabs.executeScript(). 26 // A ScriptInjector to handle tabs.executeScript().
27 class ProgrammaticScriptInjector : public ScriptInjector { 27 class ProgrammaticScriptInjector : public ScriptInjector {
28 public: 28 public:
29 ProgrammaticScriptInjector(const ExtensionMsg_ExecuteCode_Params& params, 29 ProgrammaticScriptInjector(const ExtensionMsg_ExecuteCode_Params& params,
30 blink::WebFrame* web_frame); 30 blink::WebFrame* web_frame);
31 ~ProgrammaticScriptInjector() override; 31 ~ProgrammaticScriptInjector() override;
32 32
33 private: 33 private:
34 // ScriptInjector implementation. 34 // ScriptInjector implementation.
35 UserScript::InjectionType script_type() const override; 35 UserScript::InjectionType script_type() const override;
36 bool ShouldExecuteInChildFrames() const override; 36 bool ShouldExecuteInChildFrames() const override;
37 bool ShouldExecuteInMainWorld() const override; 37 bool ShouldExecuteInMainWorld() const override;
38 bool IsUserGesture() const override; 38 bool IsUserGesture() const override;
39 bool ExpectsResults() const override; 39 bool ExpectsResults() const override;
40 bool ShouldInjectJs(UserScript::RunLocation run_location) const override; 40 bool ShouldInjectJs(UserScript::RunLocation run_location) const override;
41 bool ShouldInjectCss(UserScript::RunLocation run_location) const override; 41 bool ShouldInjectCss(UserScript::RunLocation run_location) const override;
42 PermissionsData::AccessType CanExecuteOnFrame( 42 PermissionsData::AccessType CanExecuteOnFrame(
43 const Extension* extension, 43 const Host* host,
44 blink::WebFrame* web_frame, 44 blink::WebFrame* web_frame,
45 int tab_id, 45 int tab_id,
46 const GURL& top_url) const override; 46 const GURL& top_url) const override;
47 std::vector<blink::WebScriptSource> GetJsSources( 47 std::vector<blink::WebScriptSource> GetJsSources(
48 UserScript::RunLocation run_location) const override; 48 UserScript::RunLocation run_location) const override;
49 std::vector<std::string> GetCssSources( 49 std::vector<std::string> GetCssSources(
50 UserScript::RunLocation run_location) const override; 50 UserScript::RunLocation run_location) const override;
51 void OnInjectionComplete(scoped_ptr<base::ListValue> execution_results, 51 void OnInjectionComplete(scoped_ptr<base::ListValue> execution_results,
52 ScriptsRunInfo* scripts_run_info, 52 ScriptsRunInfo* scripts_run_info,
53 UserScript::RunLocation run_location) override; 53 UserScript::RunLocation run_location) override;
(...skipping 20 matching lines...) Expand all
74 74
75 // Whether or not this script injection has finished. 75 // Whether or not this script injection has finished.
76 bool finished_; 76 bool finished_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); 78 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector);
79 }; 79 };
80 80
81 } // namespace extensions 81 } // namespace extensions
82 82
83 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ 83 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698