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

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

Issue 2628053003: Remove extension group from DOMWrapperWorld. (Closed)
Patch Set: Created 3 years, 11 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_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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ~ScriptContextSet(); 48 ~ScriptContextSet();
49 49
50 // Returns the number of contexts being tracked by this set. 50 // Returns the number of contexts being tracked by this set.
51 // This may also include invalid contexts. TODO(kalman): Useful? 51 // This may also include invalid contexts. TODO(kalman): Useful?
52 size_t size() const { return contexts_.size(); } 52 size_t size() const { return contexts_.size(); }
53 53
54 // Creates and starts managing a new ScriptContext. Ownership is held. 54 // Creates and starts managing a new ScriptContext. Ownership is held.
55 // Returns a weak reference to the new ScriptContext. 55 // Returns a weak reference to the new ScriptContext.
56 ScriptContext* Register(blink::WebLocalFrame* frame, 56 ScriptContext* Register(blink::WebLocalFrame* frame,
57 const v8::Local<v8::Context>& v8_context, 57 const v8::Local<v8::Context>& v8_context,
58 int extension_group,
59 int world_id); 58 int world_id);
60 59
61 // If the specified context is contained in this set, remove it, then delete 60 // If the specified context is contained in this set, remove it, then delete
62 // it asynchronously. After this call returns the context object will still 61 // it asynchronously. After this call returns the context object will still
63 // be valid, but its frame() pointer will be cleared. 62 // be valid, but its frame() pointer will be cleared.
64 void Remove(ScriptContext* context); 63 void Remove(ScriptContext* context);
65 64
66 // Gets the ScriptContext corresponding to v8::Context::GetCurrent(), or 65 // Gets the ScriptContext corresponding to v8::Context::GetCurrent(), or
67 // NULL if no such context exists. 66 // NULL if no such context exists.
68 ScriptContext* GetCurrent() const; 67 ScriptContext* GetCurrent() const;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // extension ID associated with the main world's JavaScript context. If the 113 // extension ID associated with the main world's JavaScript context. If the
115 // JavaScript context isn't from an extension, returns empty string. 114 // JavaScript context isn't from an extension, returns empty string.
116 const Extension* GetExtensionFromFrameAndWorld( 115 const Extension* GetExtensionFromFrameAndWorld(
117 const blink::WebLocalFrame* frame, 116 const blink::WebLocalFrame* frame,
118 int world_id, 117 int world_id,
119 bool use_effective_url); 118 bool use_effective_url);
120 119
121 // Returns the Feature::Context type of context for a JavaScript context. 120 // Returns the Feature::Context type of context for a JavaScript context.
122 Feature::Context ClassifyJavaScriptContext( 121 Feature::Context ClassifyJavaScriptContext(
123 const Extension* extension, 122 const Extension* extension,
124 int extension_group, 123 int world_id,
125 const GURL& url, 124 const GURL& url,
126 const blink::WebSecurityOrigin& origin); 125 const blink::WebSecurityOrigin& origin);
127 126
128 // Helper for OnExtensionUnloaded(). 127 // Helper for OnExtensionUnloaded().
129 void RecordAndRemove(std::set<ScriptContext*>* removed, 128 void RecordAndRemove(std::set<ScriptContext*>* removed,
130 ScriptContext* context); 129 ScriptContext* context);
131 130
132 // Weak reference to all installed Extensions that are also active in this 131 // Weak reference to all installed Extensions that are also active in this
133 // process. 132 // process.
134 ExtensionIdSet* active_extension_ids_; 133 ExtensionIdSet* active_extension_ids_;
135 134
136 // The set of all ScriptContexts we own. 135 // The set of all ScriptContexts we own.
137 std::set<ScriptContext*> contexts_; 136 std::set<ScriptContext*> contexts_;
138 137
139 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); 138 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet);
140 }; 139 };
141 140
142 } // namespace extensions 141 } // namespace extensions
143 142
144 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ 143 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698