| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ | 5 #ifndef EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ |
| 6 #define EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ | 6 #define EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Installs a new 'route' from |name| to |handler_function|. This means that | 39 // Installs a new 'route' from |name| to |handler_function|. This means that |
| 40 // NewInstance()s of this ObjectBackedNativeHandler will have a property | 40 // NewInstance()s of this ObjectBackedNativeHandler will have a property |
| 41 // |name| which will be handled by |handler_function|. | 41 // |name| which will be handled by |handler_function|. |
| 42 // | 42 // |
| 43 // Routed functions are destroyed along with the destruction of this class, | 43 // Routed functions are destroyed along with the destruction of this class, |
| 44 // and are never called back into, therefore it's safe for |handler_function| | 44 // and are never called back into, therefore it's safe for |handler_function| |
| 45 // to bind to base::Unretained. | 45 // to bind to base::Unretained. |
| 46 void RouteFunction(const std::string& name, | 46 void RouteFunction(const std::string& name, |
| 47 const HandlerFunction& handler_function); | 47 const HandlerFunction& handler_function); |
| 48 void RouteFunction(const std::string& name, |
| 49 const std::string& feature_name, |
| 50 const HandlerFunction& handler_function); |
| 48 | 51 |
| 49 ScriptContext* context() const { return context_; } | 52 ScriptContext* context() const { return context_; } |
| 50 | 53 |
| 51 void Invalidate() override; | 54 void Invalidate() override; |
| 52 | 55 |
| 53 // The following methods are convenience wrappers for methods on v8::Object | 56 // The following methods are convenience wrappers for methods on v8::Object |
| 54 // with the corresponding names. | 57 // with the corresponding names. |
| 55 void SetPrivate(v8::Local<v8::Object> obj, | 58 void SetPrivate(v8::Local<v8::Object> obj, |
| 56 const char* key, | 59 const char* key, |
| 57 v8::Local<v8::Value> value); | 60 v8::Local<v8::Value> value); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 ScriptContext* context_; | 98 ScriptContext* context_; |
| 96 | 99 |
| 97 v8::Global<v8::ObjectTemplate> object_template_; | 100 v8::Global<v8::ObjectTemplate> object_template_; |
| 98 | 101 |
| 99 DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler); | 102 DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler); |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespace extensions | 105 } // namespace extensions |
| 103 | 106 |
| 104 #endif // EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ | 107 #endif // EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ |
| OLD | NEW |