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

Unified Diff: chrome/renderer/extensions/module_system.cc

Issue 10896032: HTML titlebars for v2 apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: kludge test fix for mac 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/extensions/module_system.h ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/module_system.cc
diff --git a/chrome/renderer/extensions/module_system.cc b/chrome/renderer/extensions/module_system.cc
index 6e4c5e36f6f33856ee93efa9a62069de1cd56d91..f87f48b7c6ffc70289759ed982ee848bb2187389 100644
--- a/chrome/renderer/extensions/module_system.cc
+++ b/chrome/renderer/extensions/module_system.cc
@@ -149,6 +149,33 @@ v8::Handle<v8::Value> ModuleSystem::RequireForJsInner(
return handle_scope.Close(exports);
}
+void ModuleSystem::CallModuleMethod(const std::string& module_name,
+ const std::string& method_name) {
+ v8::HandleScope handle_scope;
+ v8::Local<v8::Value> module =
+ v8::Local<v8::Value>::New(
+ RequireForJsInner(v8::String::New(module_name.c_str())));
+ if (module.IsEmpty() || !module->IsObject())
+ return;
+ v8::Local<v8::Value> value =
+ v8::Handle<v8::Object>::Cast(module)->Get(
+ v8::String::New(method_name.c_str()));
+ if (value.IsEmpty() || !value->IsFunction())
+ return;
+ v8::Handle<v8::Function> func =
+ v8::Handle<v8::Function>::Cast(value);
+ // TODO(jeremya/koz): refer to context_ here, not the current context.
+ v8::Handle<v8::Object> global(v8::Context::GetCurrent()->Global());
+ {
+ WebKit::WebScopedMicrotaskSuppression suppression;
+ v8::TryCatch try_catch;
+ try_catch.SetCaptureMessage(true);
+ func->Call(global, 0, NULL);
+ if (try_catch.HasCaught())
+ DumpException(try_catch);
+ }
+}
+
void ModuleSystem::RegisterNativeHandler(const std::string& name,
scoped_ptr<NativeHandler> native_handler) {
native_handler_map_[name] =
« no previous file with comments | « chrome/renderer/extensions/module_system.h ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698