| 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 14 matching lines...) Expand all Loading... |
| 25 class UserScriptInjector : public ScriptInjector, | 25 class UserScriptInjector : public ScriptInjector, |
| 26 public UserScriptSet::Observer { | 26 public UserScriptSet::Observer { |
| 27 public: | 27 public: |
| 28 UserScriptInjector(const UserScript* user_script, | 28 UserScriptInjector(const UserScript* user_script, |
| 29 UserScriptSet* user_script_set, | 29 UserScriptSet* user_script_set, |
| 30 bool is_declarative); | 30 bool is_declarative); |
| 31 ~UserScriptInjector() override; | 31 ~UserScriptInjector() override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // UserScriptSet::Observer implementation. | 34 // UserScriptSet::Observer implementation. |
| 35 void OnUserScriptsUpdated(const std::set<std::string>& changed_extensions, | 35 void OnUserScriptsUpdated(const std::set<HostID>& changed_hosts, |
| 36 const std::vector<UserScript*>& scripts) override; | 36 const std::vector<UserScript*>& scripts) override; |
| 37 | 37 |
| 38 // ScriptInjector implementation. | 38 // ScriptInjector implementation. |
| 39 UserScript::InjectionType script_type() const override; | 39 UserScript::InjectionType script_type() const override; |
| 40 bool ShouldExecuteInChildFrames() const override; | 40 bool ShouldExecuteInChildFrames() const override; |
| 41 bool ShouldExecuteInMainWorld() const override; | 41 bool ShouldExecuteInMainWorld() const override; |
| 42 bool IsUserGesture() const override; | 42 bool IsUserGesture() const override; |
| 43 bool ExpectsResults() const override; | 43 bool ExpectsResults() const override; |
| 44 bool ShouldInjectJs(UserScript::RunLocation run_location) const override; | 44 bool ShouldInjectJs(UserScript::RunLocation run_location) const override; |
| 45 bool ShouldInjectCss(UserScript::RunLocation run_location) const override; | 45 bool ShouldInjectCss(UserScript::RunLocation run_location) const override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 // The associated user script. Owned by the UserScriptInjector that created | 61 // The associated user script. Owned by the UserScriptInjector that created |
| 62 // this object. | 62 // this object. |
| 63 const UserScript* script_; | 63 const UserScript* script_; |
| 64 | 64 |
| 65 // The id of the associated user script. We cache this because when we update | 65 // The id of the associated user script. We cache this because when we update |
| 66 // the |script_| associated with this injection, the old referance may be | 66 // the |script_| associated with this injection, the old referance may be |
| 67 // deleted. | 67 // deleted. |
| 68 int script_id_; | 68 int script_id_; |
| 69 | 69 |
| 70 // The associated extension id, preserved for the same reason as |script_id|. | 70 // The associated host id, preserved for the same reason as |script_id|. |
| 71 std::string extension_id_; | 71 HostID host_id_; |
| 72 | 72 |
| 73 // Indicates whether or not this script is declarative. This influences which | 73 // Indicates whether or not this script is declarative. This influences which |
| 74 // script permissions are checked before injection. | 74 // script permissions are checked before injection. |
| 75 bool is_declarative_; | 75 bool is_declarative_; |
| 76 | 76 |
| 77 ScopedObserver<UserScriptSet, UserScriptSet::Observer> | 77 ScopedObserver<UserScriptSet, UserScriptSet::Observer> |
| 78 user_script_set_observer_; | 78 user_script_set_observer_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(UserScriptInjector); | 80 DISALLOW_COPY_AND_ASSIGN(UserScriptInjector); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace extensions | 83 } // namespace extensions |
| 84 | 84 |
| 85 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_ | 85 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_INJECTOR_H_ |
| OLD | NEW |