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_NATIVE_HANDLER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "v8/include/v8.h" | 10 #include "v8/include/v8.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Installs a new 'route' from |name| to |handler_function|. This means that | 40 // Installs a new 'route' from |name| to |handler_function|. This means that |
41 // NewInstance()s of this NativeHandler will have a property |name| which | 41 // NewInstance()s of this NativeHandler will have a property |name| which |
42 // will be handled by |handler_function|. | 42 // will be handled by |handler_function|. |
43 void RouteFunction(const std::string& name, | 43 void RouteFunction(const std::string& name, |
44 const HandlerFunction& handler_function); | 44 const HandlerFunction& handler_function); |
45 | 45 |
46 void RouteStaticFunction(const std::string& name, | 46 void RouteStaticFunction(const std::string& name, |
47 const HandlerFunc handler_func); | 47 const HandlerFunc handler_func); |
48 | 48 |
| 49 v8::Persistent<v8::ObjectTemplate> object_template_; |
| 50 |
49 private: | 51 private: |
50 static v8::Handle<v8::Value> Router(const v8::Arguments& args); | 52 static v8::Handle<v8::Value> Router(const v8::Arguments& args); |
51 | 53 |
52 std::vector<linked_ptr<HandlerFunction> > handler_functions_; | 54 std::vector<linked_ptr<HandlerFunction> > handler_functions_; |
53 v8::Persistent<v8::ObjectTemplate> object_template_; | |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(NativeHandler); | 56 DISALLOW_COPY_AND_ASSIGN(NativeHandler); |
56 }; | 57 }; |
57 | 58 |
58 } // extensions | 59 } // extensions |
59 | 60 |
60 #endif // CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ | 61 #endif // CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_ |
OLD | NEW |