OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/renderer/extensions/experimental.socket_custom_bindings.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "chrome/common/extensions/extension_action.h" | |
10 #include "chrome/renderer/extensions/extension_dispatcher.h" | |
11 #include "grit/renderer_resources.h" | |
12 #include "v8/include/v8.h" | |
13 | |
14 namespace { | |
15 | |
16 v8::Handle<v8::Value> GetNextSocketEventId(const v8::Arguments& args) { | |
17 // Note: this works because the socket API only works in the extension | |
18 // process, not content scripts. | |
19 static int next_event_id = 1; | |
20 return v8::Integer::New(next_event_id++); | |
21 } | |
22 | |
23 } // namespace | |
24 | |
25 namespace extensions { | |
26 | |
27 ExperimentalSocketCustomBindings::ExperimentalSocketCustomBindings() | |
28 : ChromeV8Extension(NULL) { | |
29 RouteStaticFunction("GetNextSocketEventId", &GetNextSocketEventId); | |
30 } | |
31 | |
32 } // extensions | |
OLD | NEW |