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

Side by Side Diff: chrome/renderer/extensions/chrome_v8_context.h

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_
6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chrome/renderer/module_system.h"
12 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
13 14
14 namespace WebKit { 15 namespace WebKit {
15 class WebFrame; 16 class WebFrame;
16 } 17 }
17 18
18 namespace content { 19 namespace content {
19 class RenderView; 20 class RenderView;
20 } 21 }
21 22
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return web_frame_; 54 return web_frame_;
54 } 55 }
55 void clear_web_frame() { 56 void clear_web_frame() {
56 web_frame_ = NULL; 57 web_frame_ = NULL;
57 } 58 }
58 59
59 ContextType context_type() const { 60 ContextType context_type() const {
60 return context_type_; 61 return context_type_;
61 } 62 }
62 63
64 void set_module_system(scoped_ptr<ModuleSystem> module_system) {
65 module_system_ = module_system.Pass();
66 }
67
63 // Returns a special Chrome-specific hidden object that is associated with a 68 // Returns a special Chrome-specific hidden object that is associated with a
64 // context, but not reachable from the JavaScript in that context. This is 69 // context, but not reachable from the JavaScript in that context. This is
65 // used by our v8::Extension implementations as a way to share code and as a 70 // used by our v8::Extension implementations as a way to share code and as a
66 // bridge between C++ and JavaScript. 71 // bridge between C++ and JavaScript.
67 static v8::Handle<v8::Value> GetOrCreateChromeHidden( 72 static v8::Handle<v8::Value> GetOrCreateChromeHidden(
68 v8::Handle<v8::Context> context); 73 v8::Handle<v8::Context> context);
69 74
70 // Return the chromeHidden object associated with this context, or an empty 75 // Return the chromeHidden object associated with this context, or an empty
71 // handle if no chrome hidden has been created (by GetOrCreateChromeHidden) 76 // handle if no chrome hidden has been created (by GetOrCreateChromeHidden)
72 // yet for this context. 77 // yet for this context.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // The WebFrame associated with this context. This can be NULL because this 111 // The WebFrame associated with this context. This can be NULL because this
107 // object can outlive is destroyed asynchronously. 112 // object can outlive is destroyed asynchronously.
108 WebKit::WebFrame* web_frame_; 113 WebKit::WebFrame* web_frame_;
109 114
110 // The extension ID this context is associated with. 115 // The extension ID this context is associated with.
111 std::string extension_id_; 116 std::string extension_id_;
112 117
113 // The type of context. 118 // The type of context.
114 ContextType context_type_; 119 ContextType context_type_;
115 120
121 // Owns and structures the JS that is injected to set up extension bindings.
122 scoped_ptr<ModuleSystem> module_system_;
123
116 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); 124 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context);
117 }; 125 };
118 126
119 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ 127 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_private_custom_bindings.cc ('k') | chrome/renderer/extensions/chrome_v8_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698