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

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

Issue 159542: Add a WebKit API that registers a V8 extension to be loaded into content (Closed)
Patch Set: final Created 11 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extensions/event_bindings.h" 5 #include "chrome/renderer/extensions/event_bindings.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 return v8::Undefined(); 101 return v8::Undefined();
102 } 102 }
103 }; 103 };
104 104
105 } // namespace 105 } // namespace
106 106
107 const char* EventBindings::kName = "chrome/EventBindings"; 107 const char* EventBindings::kName = "chrome/EventBindings";
108 108
109 v8::Extension* EventBindings::Get() { 109 v8::Extension* EventBindings::Get() {
110 static v8::Extension* extension = new ExtensionImpl();
110 bindings_registered = true; 111 bindings_registered = true;
111 return new ExtensionImpl(); 112 return extension;
112 } 113 }
113 114
114 // static 115 // static
115 void EventBindings::SetRenderThread(RenderThreadBase* thread) { 116 void EventBindings::SetRenderThread(RenderThreadBase* thread) {
116 render_thread = thread; 117 render_thread = thread;
117 in_unit_tests = true; 118 in_unit_tests = true;
118 } 119 }
119 120
120 // static 121 // static
121 RenderThreadBase* EventBindings::GetRenderThread() { 122 RenderThreadBase* EventBindings::GetRenderThread() {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void EventBindings::CallFunction(const std::string& function_name, 267 void EventBindings::CallFunction(const std::string& function_name,
267 int argc, v8::Handle<v8::Value>* argv, 268 int argc, v8::Handle<v8::Value>* argv,
268 RenderView* render_view) { 269 RenderView* render_view) {
269 for (ContextList::iterator it = GetContexts().begin(); 270 for (ContextList::iterator it = GetContexts().begin();
270 it != GetContexts().end(); ++it) { 271 it != GetContexts().end(); ++it) {
271 if (render_view && render_view != (*it)->render_view) 272 if (render_view && render_view != (*it)->render_view)
272 continue; 273 continue;
273 CallFunctionInContext((*it)->context, function_name, argc, argv); 274 CallFunctionInContext((*it)->context, function_name, argc, argv);
274 } 275 }
275 } 276 }
OLDNEW
« no previous file with comments | « chrome/renderer/extension_groups.h ('k') | chrome/renderer/extensions/extension_process_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698