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 #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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ipc/ipc_listener.h" | 11 #include "ipc/ipc_listener.h" |
12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
13 | 13 |
| 14 namespace extensions { |
14 class ChromeV8Context; | 15 class ChromeV8Context; |
15 | 16 |
16 // Base class for context-scoped handlers used with ChromeV8Extension. | 17 // Base class for context-scoped handlers used with ChromeV8Extension. |
17 // TODO(koz): Rename/refactor this somehow. Maybe just pull it into | 18 // TODO(koz): Rename/refactor this somehow. Maybe just pull it into |
18 // ChromeV8Extension. | 19 // ChromeV8Extension. |
19 class ChromeV8ExtensionHandler : public IPC::Listener { | 20 class ChromeV8ExtensionHandler : public IPC::Listener { |
20 public: | 21 public: |
21 virtual ~ChromeV8ExtensionHandler(); | 22 virtual ~ChromeV8ExtensionHandler(); |
22 | 23 |
23 // IPC::Listener | 24 // IPC::Listener |
24 virtual bool OnMessageReceived(const IPC::Message& message) = 0; | 25 virtual bool OnMessageReceived(const IPC::Message& message) = 0; |
25 | 26 |
26 protected: | 27 protected: |
27 explicit ChromeV8ExtensionHandler(ChromeV8Context* context); | 28 explicit ChromeV8ExtensionHandler(ChromeV8Context* context); |
28 int GetRoutingID(); | 29 int GetRoutingID(); |
29 void Send(IPC::Message* message); | 30 void Send(IPC::Message* message); |
30 ChromeV8Context* context_; | 31 ChromeV8Context* context_; |
31 | 32 |
32 private: | 33 private: |
33 int routing_id_; | 34 int routing_id_; |
34 DISALLOW_COPY_AND_ASSIGN(ChromeV8ExtensionHandler); | 35 DISALLOW_COPY_AND_ASSIGN(ChromeV8ExtensionHandler); |
35 }; | 36 }; |
36 | 37 |
| 38 } // namespace extensions |
| 39 |
37 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ | 40 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_HANDLER_H_ |
OLD | NEW |