OLD | NEW |
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/tts_custom_bindings.h" | 5 #include "chrome/renderer/extensions/tts_custom_bindings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "grit/renderer_resources.h" | 10 #include "grit/renderer_resources.h" |
11 #include "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 TTSCustomBindings::TTSCustomBindings( | 15 TTSCustomBindings::TTSCustomBindings( |
16 Dispatcher* dispatcher, v8::Handle<v8::Context> v8_context) | 16 Dispatcher* dispatcher, ChromeV8Context* context) |
17 : ChromeV8Extension(dispatcher, v8_context) { | 17 : ChromeV8Extension(dispatcher, context) { |
18 RouteFunction("GetNextTTSEventId", | 18 RouteFunction("GetNextTTSEventId", |
19 base::Bind(&TTSCustomBindings::GetNextTTSEventId, | 19 base::Bind(&TTSCustomBindings::GetNextTTSEventId, |
20 base::Unretained(this))); | 20 base::Unretained(this))); |
21 } | 21 } |
22 | 22 |
23 v8::Handle<v8::Value> TTSCustomBindings::GetNextTTSEventId( | 23 v8::Handle<v8::Value> TTSCustomBindings::GetNextTTSEventId( |
24 const v8::Arguments& args) { | 24 const v8::Arguments& args) { |
25 // Note: this works because the TTS API only works in the | 25 // Note: this works because the TTS API only works in the |
26 // extension process, not content scripts. | 26 // extension process, not content scripts. |
27 static int next_tts_event_id = 1; | 27 static int next_tts_event_id = 1; |
28 return v8::Integer::New(next_tts_event_id++); | 28 return v8::Integer::New(next_tts_event_id++); |
29 } | 29 } |
30 | 30 |
31 } // extensions | 31 } // extensions |
OLD | NEW |