OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
13 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
14 | 14 |
15 class ChromeV8Context; | 15 class ChromeV8Context; |
16 | 16 |
17 // Base class for context-scoped handlers used with ChromeV8Extension. | 17 // Base class for context-scoped handlers used with ChromeV8Extension. |
Aaron Boodman
2012/03/01 07:24:26
TODO(koz): Rename/refactor this somehow. Maybe jus
koz (OOO until 15th September)
2012/03/02 01:13:58
Done.
| |
18 class ChromeV8ExtensionHandler : public IPC::Channel::Listener { | 18 class ChromeV8ExtensionHandler : public IPC::Channel::Listener { |
19 public: | 19 public: |
20 virtual v8::Handle<v8::Value> HandleNativeFunction( | |
21 const std::string& name, | |
22 const v8::Arguments& arguments) = 0; | |
23 virtual ~ChromeV8ExtensionHandler(); | 20 virtual ~ChromeV8ExtensionHandler(); |
24 | 21 |
25 // IPC::Channel::Listener | 22 // IPC::Channel::Listener |
26 virtual bool OnMessageReceived(const IPC::Message& message) = 0; | 23 virtual bool OnMessageReceived(const IPC::Message& message) = 0; |
27 | 24 |
28 protected: | 25 protected: |
29 explicit ChromeV8ExtensionHandler(ChromeV8Context* context); | 26 explicit ChromeV8ExtensionHandler(ChromeV8Context* context); |
30 int GetRoutingId(); | 27 int GetRoutingId(); |
31 void Send(IPC::Message* message); | 28 void Send(IPC::Message* message); |
32 ChromeV8Context* context_; | 29 ChromeV8Context* context_; |
33 | 30 |
34 private: | 31 private: |
35 int routing_id_; | 32 int routing_id_; |
36 DISALLOW_COPY_AND_ASSIGN(ChromeV8ExtensionHandler); | 33 DISALLOW_COPY_AND_ASSIGN(ChromeV8ExtensionHandler); |
37 }; | 34 }; |
38 | 35 |
39 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ | 36 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ |
OLD | NEW |