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

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

Issue 327953002: Make MessagingBindings use ScriptContextSet::ForEach (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ForEach shortcuts Created 6 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 | Annotate | Revision Log
« no previous file with comments | « extensions/renderer/resources/messaging.js ('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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 27 matching lines...) Expand all
38 38
39 // Clears the WebFrame for this contexts and invalidates the associated 39 // Clears the WebFrame for this contexts and invalidates the associated
40 // ModuleSystem. 40 // ModuleSystem.
41 void Invalidate(); 41 void Invalidate();
42 42
43 // Returns true if this context is still valid, false if it isn't. 43 // Returns true if this context is still valid, false if it isn't.
44 // A context becomes invalid via Invalidate(). 44 // A context becomes invalid via Invalidate().
45 bool is_valid() const { return !v8_context_.IsEmpty(); } 45 bool is_valid() const { return !v8_context_.IsEmpty(); }
46 46
47 v8::Handle<v8::Context> v8_context() const { 47 v8::Handle<v8::Context> v8_context() const {
48 return v8_context_.NewHandle(v8::Isolate::GetCurrent()); 48 return v8_context_.NewHandle(isolate());
49 } 49 }
50 50
51 const Extension* extension() const { return extension_.get(); } 51 const Extension* extension() const { return extension_.get(); }
52 52
53 blink::WebFrame* web_frame() const { return web_frame_; } 53 blink::WebFrame* web_frame() const { return web_frame_; }
54 54
55 Feature::Context context_type() const { return context_type_; } 55 Feature::Context context_type() const { return context_type_; }
56 56
57 void set_module_system(scoped_ptr<ModuleSystem> module_system) { 57 void set_module_system(scoped_ptr<ModuleSystem> module_system) {
58 module_system_ = module_system.Pass(); 58 module_system_ = module_system.Pass();
59 } 59 }
60 60
61 ModuleSystem* module_system() { return module_system_.get(); } 61 ModuleSystem* module_system() { return module_system_.get(); }
62 62
63 SafeBuiltins* safe_builtins() { return &safe_builtins_; } 63 SafeBuiltins* safe_builtins() { return &safe_builtins_; }
64 64
65 const SafeBuiltins* safe_builtins() const { return &safe_builtins_; } 65 const SafeBuiltins* safe_builtins() const { return &safe_builtins_; }
66 66
67 // Returns the ID of the extension associated with this context, or empty 67 // Returns the ID of the extension associated with this context, or empty
68 // string if there is no such extension. 68 // string if there is no such extension.
69 std::string GetExtensionID() const; 69 const std::string& GetExtensionID() const;
70 70
71 // Returns the RenderView associated with this context. Can return NULL if the 71 // Returns the RenderView associated with this context. Can return NULL if the
72 // context is in the process of being destroyed. 72 // context is in the process of being destroyed.
73 content::RenderView* GetRenderView() const; 73 content::RenderView* GetRenderView() const;
74 74
75 // Runs |function| with appropriate scopes. Doesn't catch exceptions, callers 75 // Runs |function| with appropriate scopes. Doesn't catch exceptions, callers
76 // must do that if they want. 76 // must do that if they want.
77 // 77 //
78 // USE THIS METHOD RATHER THAN v8::Function::Call WHEREVER POSSIBLE. 78 // USE THIS METHOD RATHER THAN v8::Function::Call WHEREVER POSSIBLE.
79 v8::Local<v8::Value> CallFunction(v8::Handle<v8::Function> function, 79 v8::Local<v8::Value> CallFunction(v8::Handle<v8::Function> function,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SafeBuiltins safe_builtins_; 143 SafeBuiltins safe_builtins_;
144 144
145 v8::Isolate* isolate_; 145 v8::Isolate* isolate_;
146 146
147 DISALLOW_COPY_AND_ASSIGN(ScriptContext); 147 DISALLOW_COPY_AND_ASSIGN(ScriptContext);
148 }; 148 };
149 149
150 } // namespace extensions 150 } // namespace extensions
151 151
152 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 152 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
OLDNEW
« no previous file with comments | « extensions/renderer/resources/messaging.js ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698