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_SCRIPT_CONTEXT_SET_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 // NULL if no such context exists. | 70 // NULL if no such context exists. |
71 ScriptContext* GetCurrent() const; | 71 ScriptContext* GetCurrent() const; |
72 | 72 |
73 // Gets the ScriptContext corresponding to v8::Context::GetCalling(), or | 73 // Gets the ScriptContext corresponding to v8::Context::GetCalling(), or |
74 // NULL if no such context exists. | 74 // NULL if no such context exists. |
75 ScriptContext* GetCalling() const; | 75 ScriptContext* GetCalling() const; |
76 | 76 |
77 // Gets the ScriptContext corresponding to the specified | 77 // Gets the ScriptContext corresponding to the specified |
78 // v8::Context or NULL if no such context exists. | 78 // v8::Context or NULL if no such context exists. |
79 ScriptContext* GetByV8Context(const v8::Local<v8::Context>& context) const; | 79 ScriptContext* GetByV8Context(const v8::Local<v8::Context>& context) const; |
80 // Static equivalent of the above. | |
not at google - send to devlin
2015/06/22 21:20:15
I'd rather a static Get() method of ScriptContextS
Devlin
2015/06/22 21:23:11
But since ScriptContextSet can be null while testi
not at google - send to devlin
2015/06/22 21:26:38
If you *promise* to pull ownership of ScriptContex
| |
81 static ScriptContext* GetContextByV8Context( | |
82 const v8::Local<v8::Context>& context); | |
80 | 83 |
81 // Synchronously runs |callback| with each ScriptContext that belongs to | 84 // Synchronously runs |callback| with each ScriptContext that belongs to |
82 // |extension_id| in |render_view|. | 85 // |extension_id| in |render_view|. |
83 // | 86 // |
84 // An empty |extension_id| will match all extensions, and a NULL |render_view| | 87 // An empty |extension_id| will match all extensions, and a NULL |render_view| |
85 // will match all render views, but try to use the inline variants of these | 88 // will match all render views, but try to use the inline variants of these |
86 // methods instead. | 89 // methods instead. |
87 void ForEach(const std::string& extension_id, | 90 void ForEach(const std::string& extension_id, |
88 content::RenderView* render_view, | 91 content::RenderView* render_view, |
89 const base::Callback<void(ScriptContext*)>& callback) const; | 92 const base::Callback<void(ScriptContext*)>& callback) const; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 | 139 |
137 // The set of all ScriptContexts we own. | 140 // The set of all ScriptContexts we own. |
138 std::set<ScriptContext*> contexts_; | 141 std::set<ScriptContext*> contexts_; |
139 | 142 |
140 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); | 143 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); |
141 }; | 144 }; |
142 | 145 |
143 } // namespace extensions | 146 } // namespace extensions |
144 | 147 |
145 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 148 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
OLD | NEW |