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

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

Issue 988633003: Refactoring: de-couple Extensions from "script injection System" [render side]:4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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_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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698