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

Side by Side Diff: chrome/renderer/extensions/module_system.cc

Issue 10879107: Move ModuleSystem and NativeHandler to extensions/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 #include "chrome/renderer/module_system.h" 5 #include "chrome/renderer/extensions/module_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedMicrotaskSup pression.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedMicrotaskSup pression.h"
9 9
10 namespace { 10 namespace {
11 11
12 const char* kModuleSystem = "module_system"; 12 const char* kModuleSystem = "module_system";
13 const char* kModuleName = "module_name"; 13 const char* kModuleName = "module_name";
14 const char* kModuleField = "module_field"; 14 const char* kModuleField = "module_field";
15 const char* kModulesField = "modules"; 15 const char* kModulesField = "modules";
16 16
17 } // namespace 17 } // namespace
18 18
19 namespace extensions {
20
19 ModuleSystem::ModuleSystem(v8::Handle<v8::Context> context, 21 ModuleSystem::ModuleSystem(v8::Handle<v8::Context> context,
20 SourceMap* source_map) 22 SourceMap* source_map)
21 : context_(v8::Persistent<v8::Context>::New(context)), 23 : context_(v8::Persistent<v8::Context>::New(context)),
22 source_map_(source_map), 24 source_map_(source_map),
23 natives_enabled_(0) { 25 natives_enabled_(0) {
24 RouteFunction("require", 26 RouteFunction("require",
25 base::Bind(&ModuleSystem::RequireForJs, base::Unretained(this))); 27 base::Bind(&ModuleSystem::RequireForJs, base::Unretained(this)));
26 RouteFunction("requireNative", 28 RouteFunction("requireNative",
27 base::Bind(&ModuleSystem::GetNative, base::Unretained(this))); 29 base::Bind(&ModuleSystem::GetNative, base::Unretained(this)));
28 30
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 v8::Handle<v8::String> left = 260 v8::Handle<v8::String> left =
259 v8::String::New("(function(require, requireNative, exports) {"); 261 v8::String::New("(function(require, requireNative, exports) {");
260 v8::Handle<v8::String> right = v8::String::New("\n})"); 262 v8::Handle<v8::String> right = v8::String::New("\n})");
261 return handle_scope.Close( 263 return handle_scope.Close(
262 v8::String::Concat(left, v8::String::Concat(source, right))); 264 v8::String::Concat(left, v8::String::Concat(source, right)));
263 } 265 }
264 266
265 v8::Handle<v8::Value> ModuleSystem::ThrowException(const std::string& message) { 267 v8::Handle<v8::Value> ModuleSystem::ThrowException(const std::string& message) {
266 return v8::ThrowException(v8::String::New(message.c_str())); 268 return v8::ThrowException(v8::String::New(message.c_str()));
267 } 269 }
270
271 } // extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/module_system.h ('k') | chrome/renderer/extensions/module_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698