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

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

Issue 2241203003: Pass user session type to extension feature checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out some stuff Created 4 years, 4 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_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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Note that ScriptContexts bound to worker threads will not have the full 43 // Note that ScriptContexts bound to worker threads will not have the full
44 // functionality as those bound to the main RenderThread. 44 // functionality as those bound to the main RenderThread.
45 class ScriptContext : public RequestSender::Source { 45 class ScriptContext : public RequestSender::Source {
46 public: 46 public:
47 using RunScriptExceptionHandler = base::Callback<void(const v8::TryCatch&)>; 47 using RunScriptExceptionHandler = base::Callback<void(const v8::TryCatch&)>;
48 48
49 ScriptContext(const v8::Local<v8::Context>& context, 49 ScriptContext(const v8::Local<v8::Context>& context,
50 blink::WebLocalFrame* frame, 50 blink::WebLocalFrame* frame,
51 const Extension* extension, 51 const Extension* extension,
52 Feature::Context context_type, 52 Feature::Context context_type,
53 Feature::SessionType session_type,
53 const Extension* effective_extension, 54 const Extension* effective_extension,
54 Feature::Context effective_context_type); 55 Feature::Context effective_context_type);
55 ~ScriptContext() override; 56 ~ScriptContext() override;
56 57
57 // Returns whether |url| from any Extension in |extension_set| is sandboxed, 58 // Returns whether |url| from any Extension in |extension_set| is sandboxed,
58 // as declared in each Extension's manifest. 59 // as declared in each Extension's manifest.
59 // TODO(kalman): Delete this when crbug.com/466373 is fixed. 60 // TODO(kalman): Delete this when crbug.com/466373 is fixed.
60 // See comment in HasAccessOrThrowError. 61 // See comment in HasAccessOrThrowError.
61 static bool IsSandboxedPage(const GURL& url); 62 static bool IsSandboxedPage(const GURL& url);
62 63
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // The WebLocalFrame associated with this context. This can be NULL because 223 // The WebLocalFrame associated with this context. This can be NULL because
223 // this object can outlive is destroyed asynchronously. 224 // this object can outlive is destroyed asynchronously.
224 blink::WebLocalFrame* web_frame_; 225 blink::WebLocalFrame* web_frame_;
225 226
226 // The extension associated with this context, or NULL if there is none. This 227 // The extension associated with this context, or NULL if there is none. This
227 // might be a hosted app in the case that this context is hosting a web URL. 228 // might be a hosted app in the case that this context is hosting a web URL.
228 scoped_refptr<const Extension> extension_; 229 scoped_refptr<const Extension> extension_;
229 230
230 // The type of context. 231 // The type of context.
231 Feature::Context context_type_; 232 Feature::Context context_type_;
233 Feature::SessionType session_type_;
Devlin 2016/08/17 17:07:35 This isn't really related to the context - it's gl
tbarzic 2016/08/17 19:49:01 yeah, makes sense, I probably should have noticed
232 234
233 // The effective extension associated with this context, or NULL if there is 235 // The effective extension associated with this context, or NULL if there is
234 // none. This is different from the above extension if this context is in an 236 // none. This is different from the above extension if this context is in an
235 // about:blank iframe for example. 237 // about:blank iframe for example.
236 scoped_refptr<const Extension> effective_extension_; 238 scoped_refptr<const Extension> effective_extension_;
237 239
238 // The type of context. 240 // The type of context.
239 Feature::Context effective_context_type_; 241 Feature::Context effective_context_type_;
240 242
241 // Owns and structures the JS that is injected to set up extension bindings. 243 // Owns and structures the JS that is injected to set up extension bindings.
(...skipping 16 matching lines...) Expand all
258 std::unique_ptr<Runner> runner_; 260 std::unique_ptr<Runner> runner_;
259 261
260 base::ThreadChecker thread_checker_; 262 base::ThreadChecker thread_checker_;
261 263
262 DISALLOW_COPY_AND_ASSIGN(ScriptContext); 264 DISALLOW_COPY_AND_ASSIGN(ScriptContext);
263 }; 265 };
264 266
265 } // namespace extensions 267 } // namespace extensions
266 268
267 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 269 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698