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

Side by Side Diff: chrome/renderer/extensions/experimental.socket_custom_bindings.cc

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/extensions/experimental.socket_custom_bindings.h" 5 #include "chrome/renderer/extensions/experimental.socket_custom_bindings.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/common/extensions/extension_action.h" 9 #include "chrome/common/extensions/extension_action.h"
10 #include "chrome/renderer/extensions/extension_dispatcher.h" 10 #include "chrome/renderer/extensions/extension_dispatcher.h"
(...skipping 12 matching lines...) Expand all
23 dependencies, 23 dependencies,
24 NULL) {} 24 NULL) {}
25 25
26 static v8::Handle<v8::Value> GetNextSocketEventId(const v8::Arguments& args) { 26 static v8::Handle<v8::Value> GetNextSocketEventId(const v8::Arguments& args) {
27 // Note: this works because the socket API only works in the extension 27 // Note: this works because the socket API only works in the extension
28 // process, not content scripts. 28 // process, not content scripts.
29 static int next_event_id = 1; 29 static int next_event_id = 1;
30 return v8::Integer::New(next_event_id++); 30 return v8::Integer::New(next_event_id++);
31 } 31 }
32 32
33 void ExperimentalSocketCustomBindings::SetNativeFunctions(
34 v8::Handle<v8::Object> object) {
35 RouteFunctionToStatic("GetNextSocketEventId", GetNextSocketEventId, object);
36 }
37
33 v8::Handle<v8::FunctionTemplate> 38 v8::Handle<v8::FunctionTemplate>
34 ExperimentalSocketCustomBindings::GetNativeFunction( 39 ExperimentalSocketCustomBindings::GetNativeFunction(
35 v8::Handle<v8::String> name) { 40 v8::Handle<v8::String> name) {
36 if (name->Equals(v8::String::New("GetNextSocketEventId"))) 41 if (name->Equals(v8::String::New("GetNextSocketEventId")))
37 return v8::FunctionTemplate::New(GetNextSocketEventId); 42 return v8::FunctionTemplate::New(GetNextSocketEventId);
38 43
39 return ChromeV8Extension::GetNativeFunction(name); 44 return ChromeV8Extension::GetNativeFunction(name);
40 } 45 }
41 46
42 } // extensions 47 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698