OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 UserScriptInjector(const UserScript* user_script, | 27 UserScriptInjector(const UserScript* user_script, |
28 UserScriptSet* user_script_set, | 28 UserScriptSet* user_script_set, |
29 bool is_declarative); | 29 bool is_declarative); |
30 virtual ~UserScriptInjector(); | 30 virtual ~UserScriptInjector(); |
31 | 31 |
32 private: | 32 private: |
33 // UserScriptSet::Observer implementation. | 33 // UserScriptSet::Observer implementation. |
34 virtual void OnUserScriptsUpdated( | 34 virtual void OnUserScriptsUpdated( |
35 const std::set<std::string>& changed_extensions, | 35 const std::set<std::string>& changed_extensions, |
36 const std::vector<UserScript*>& scripts) OVERRIDE; | 36 const std::vector<UserScript*>& scripts) override; |
37 | 37 |
38 // ScriptInjector implementation. | 38 // ScriptInjector implementation. |
39 virtual UserScript::InjectionType script_type() const OVERRIDE; | 39 virtual UserScript::InjectionType script_type() const override; |
40 virtual bool ShouldExecuteInChildFrames() const OVERRIDE; | 40 virtual bool ShouldExecuteInChildFrames() const override; |
41 virtual bool ShouldExecuteInMainWorld() const OVERRIDE; | 41 virtual bool ShouldExecuteInMainWorld() const override; |
42 virtual bool IsUserGesture() const OVERRIDE; | 42 virtual bool IsUserGesture() const override; |
43 virtual bool ExpectsResults() const OVERRIDE; | 43 virtual bool ExpectsResults() const override; |
44 virtual bool ShouldInjectJs( | 44 virtual bool ShouldInjectJs( |
45 UserScript::RunLocation run_location) const OVERRIDE; | 45 UserScript::RunLocation run_location) const override; |
46 virtual bool ShouldInjectCss( | 46 virtual bool ShouldInjectCss( |
47 UserScript::RunLocation run_location) const OVERRIDE; | 47 UserScript::RunLocation run_location) const override; |
48 virtual PermissionsData::AccessType CanExecuteOnFrame( | 48 virtual PermissionsData::AccessType CanExecuteOnFrame( |
49 const Extension* extension, | 49 const Extension* extension, |
50 blink::WebFrame* web_frame, | 50 blink::WebFrame* web_frame, |
51 int tab_id, | 51 int tab_id, |
52 const GURL& top_url) const OVERRIDE; | 52 const GURL& top_url) const override; |
53 virtual std::vector<blink::WebScriptSource> GetJsSources( | 53 virtual std::vector<blink::WebScriptSource> GetJsSources( |
54 UserScript::RunLocation run_location) const OVERRIDE; | 54 UserScript::RunLocation run_location) const override; |
55 virtual std::vector<std::string> GetCssSources( | 55 virtual std::vector<std::string> GetCssSources( |
56 UserScript::RunLocation run_location) const OVERRIDE; | 56 UserScript::RunLocation run_location) const override; |
57 virtual void OnInjectionComplete( | 57 virtual void OnInjectionComplete( |
58 scoped_ptr<base::ListValue> execution_results, | 58 scoped_ptr<base::ListValue> execution_results, |
59 ScriptsRunInfo* scripts_run_info, | 59 ScriptsRunInfo* scripts_run_info, |
60 UserScript::RunLocation run_location) OVERRIDE; | 60 UserScript::RunLocation run_location) override; |
61 virtual void OnWillNotInject(InjectFailureReason reason) OVERRIDE; | 61 virtual void OnWillNotInject(InjectFailureReason reason) override; |
62 | 62 |
63 // The associated user script. Owned by the UserScriptInjector that created | 63 // The associated user script. Owned by the UserScriptInjector that created |
64 // this object. | 64 // this object. |
65 const UserScript* script_; | 65 const UserScript* script_; |
66 | 66 |
67 // The id of the associated user script. We cache this because when we update | 67 // The id of the associated user script. We cache this because when we update |
68 // the |script_| associated with this injection, the old referance may be | 68 // the |script_| associated with this injection, the old referance may be |
69 // deleted. | 69 // deleted. |
70 int script_id_; | 70 int script_id_; |
71 | 71 |
72 // The associated extension id, preserved for the same reason as |script_id|. | 72 // The associated extension id, preserved for the same reason as |script_id|. |
73 std::string extension_id_; | 73 std::string extension_id_; |
74 | 74 |
75 // Indicates whether or not this script is declarative. This influences which | 75 // Indicates whether or not this script is declarative. This influences which |
76 // script permissions are checked before injection. | 76 // script permissions are checked before injection. |
77 bool is_declarative_; | 77 bool is_declarative_; |
78 | 78 |
79 ScopedObserver<UserScriptSet, UserScriptSet::Observer> | 79 ScopedObserver<UserScriptSet, UserScriptSet::Observer> |
80 user_script_set_observer_; | 80 user_script_set_observer_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(UserScriptInjector); | 82 DISALLOW_COPY_AND_ASSIGN(UserScriptInjector); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace extensions | 85 } // namespace extensions |
86 | 86 |
87 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_ | 87 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_ |
OLD | NEW |