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

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

Issue 10273016: Refactor the socket API to remove onEvent callback in socket.create() function. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update Created 8 years, 7 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
(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
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/experimental.socket_custom_bindings.h ('k') | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698