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

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

Issue 1142993002: Don't send unnecessary ExtensionMsg_Loaded IPCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: commnets Created 5 years, 6 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
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const; 117 void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const;
118 118
119 // Fires the onunload event on the unload_event module. 119 // Fires the onunload event on the unload_event module.
120 void DispatchOnUnloadEvent(); 120 void DispatchOnUnloadEvent();
121 121
122 // Returns the availability of the API |api_name|. 122 // Returns the availability of the API |api_name|.
123 Feature::Availability GetAvailability(const std::string& api_name); 123 Feature::Availability GetAvailability(const std::string& api_name);
124 124
125 // Returns a string description of the type of context this is. 125 // Returns a string description of the type of context this is.
126 std::string GetContextTypeDescription(); 126 std::string GetContextTypeDescription() const;
127 127
128 // Returns a string description of the effective type of context this is. 128 // Returns a string description of the effective type of context this is.
129 std::string GetEffectiveContextTypeDescription(); 129 std::string GetEffectiveContextTypeDescription() const;
130 130
131 v8::Isolate* isolate() const { return isolate_; } 131 v8::Isolate* isolate() const { return isolate_; }
132 132
133 // Get the URL of this context's web frame. 133 // Get the URL of this context's web frame.
134 // 134 //
135 // TODO(kalman): Remove this and replace with a GetOrigin() call which reads 135 // TODO(kalman): Remove this and replace with a GetOrigin() call which reads
136 // of WebDocument::securityOrigin(): 136 // of WebDocument::securityOrigin():
137 // - The URL can change (e.g. pushState) but the origin cannot. Luckily it 137 // - The URL can change (e.g. pushState) but the origin cannot. Luckily it
138 // appears as though callers don't make security decisions based on the 138 // appears as though callers don't make security decisions based on the
139 // result of GetURL() so it's not a problem... yet. 139 // result of GetURL() so it's not a problem... yet.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // a context for an extension which has that permission, or by being a web 173 // a context for an extension which has that permission, or by being a web
174 // context which has been granted the corresponding capability by an 174 // context which has been granted the corresponding capability by an
175 // extension. 175 // extension.
176 bool HasAPIPermission(APIPermission::ID permission) const; 176 bool HasAPIPermission(APIPermission::ID permission) const;
177 177
178 // Throws an Error in this context's JavaScript context, if this context does 178 // Throws an Error in this context's JavaScript context, if this context does
179 // not have access to |name|. Returns true if this context has access (i.e. 179 // not have access to |name|. Returns true if this context has access (i.e.
180 // no exception thrown), false if it does not (i.e. an exception was thrown). 180 // no exception thrown), false if it does not (i.e. an exception was thrown).
181 bool HasAccessOrThrowError(const std::string& name); 181 bool HasAccessOrThrowError(const std::string& name);
182 182
183 // Returns a string representation of this ScriptContext, for debugging.
184 std::string GetDebugString() const;
185
183 private: 186 private:
184 class Runner; 187 class Runner;
185 188
186 // Whether this context is valid. 189 // Whether this context is valid.
187 bool is_valid_; 190 bool is_valid_;
188 191
189 // The v8 context the bindings are accessible to. 192 // The v8 context the bindings are accessible to.
190 v8::Global<v8::Context> v8_context_; 193 v8::Global<v8::Context> v8_context_;
191 194
192 // The WebLocalFrame associated with this context. This can be NULL because 195 // The WebLocalFrame associated with this context. This can be NULL because
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 GURL url_; 229 GURL url_;
227 230
228 scoped_ptr<Runner> runner_; 231 scoped_ptr<Runner> runner_;
229 232
230 DISALLOW_COPY_AND_ASSIGN(ScriptContext); 233 DISALLOW_COPY_AND_ASSIGN(ScriptContext);
231 }; 234 };
232 235
233 } // namespace extensions 236 } // namespace extensions
234 237
235 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 238 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698