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

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

Issue 321993003: Refactor renderer-side script injection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing files Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTION_H_
6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTION_H_
7
8 #include "base/macros.h"
9 #include "extensions/renderer/script_injection.h"
10
11 class GURL;
12 struct ExtensionMsg_ExecuteCode_Params;
13
14 namespace blink {
15 class WebFrame;
16 }
17
18 namespace content {
19 class RenderView;
20 }
21
22 namespace extensions {
23 class Extension;
24
25 // A ScriptInjection to handle tabs.executeScript().
26 class ProgrammaticScriptInjection : public ScriptInjection {
27 public:
28 ProgrammaticScriptInjection(blink::WebFrame* web_frame,
29 const ExtensionMsg_ExecuteCode_Params& params,
30 int tab_id);
31 virtual ~ProgrammaticScriptInjection();
32
33 private:
34 // Returns the associated RenderView.
35 content::RenderView* GetRenderView();
36
37 // Returns true if the script can execute on the given |frame|.
38 // |top_url| is passed in for efficiency when this is used in a loop.
39 bool CanExecuteOnFrame(const Extension* extension,
40 const blink::WebFrame* frame,
41 const GURL& top_url) const;
42
43 // ScriptInjection implementation.
44 virtual void ExtensionNotFound() OVERRIDE;
45 virtual bool Allowed(const Extension* extension) OVERRIDE;
46 virtual void Inject(ScriptsRunInfo* scripts_run_info,
47 const Extension* extension) OVERRIDE;
48
49 // The parameters for injecting the script.
50 scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_;
51
52 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjection);
53 };
54
55 } // namespace extensions
56
57 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698