| Index: chrome/renderer/extensions/object_backed_native_handler.h
|
| diff --git a/chrome/renderer/extensions/native_handler.h b/chrome/renderer/extensions/object_backed_native_handler.h
|
| similarity index 53%
|
| copy from chrome/renderer/extensions/native_handler.h
|
| copy to chrome/renderer/extensions/object_backed_native_handler.h
|
| index fd6bda69169bfb3eb39f2136bd3e1abdddb67e48..997c529a5eea236c5e12d85c0a756109cbd8c29a 100644
|
| --- a/chrome/renderer/extensions/native_handler.h
|
| +++ b/chrome/renderer/extensions/object_backed_native_handler.h
|
| @@ -2,35 +2,30 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
|
| -#define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
|
| +#ifndef CHROME_RENDERER_EXTENSIONS_OBJECT_BACKED_NATIVE_HANDLER_H_
|
| +#define CHROME_RENDERER_EXTENSIONS_OBJECT_BACKED_NATIVE_HANDLER_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
|
|
| #include "base/bind.h"
|
| #include "base/memory/linked_ptr.h"
|
| +#include "chrome/renderer/extensions/native_handler.h"
|
| #include "v8/include/v8.h"
|
|
|
| -#include <string>
|
| -#include <vector>
|
| -
|
| namespace extensions {
|
|
|
| -// A NativeHandler is a factory for JS objects with functions on them that map
|
| -// to native C++ functions. Subclasses should call RouteFunction() in their
|
| -// constructor to define functions on the created JS objects.
|
| -//
|
| -// NativeHandlers are intended to be used with a ModuleSystem. The ModuleSystem
|
| -// will assume ownership of the NativeHandler, and as a ModuleSystem is tied to
|
| -// a single v8::Context, this implies that NativeHandlers will also be tied to
|
| -// a single v8::context.
|
| -// TODO(koz): Rename this to NativeJavaScriptModule.
|
| -class NativeHandler {
|
| +// An ObjectBackedNativeHandler is a factory for JS objects with functions on
|
| +// them that map to native C++ functions. Subclasses should call RouteFunction()
|
| +// in their constructor to define functions on the created JS objects.
|
| +class ObjectBackedNativeHandler : public NativeHandler {
|
| public:
|
| - explicit NativeHandler(v8::Isolate* isolate);
|
| - virtual ~NativeHandler();
|
| + explicit ObjectBackedNativeHandler(v8::Isolate* isolate);
|
| + virtual ~ObjectBackedNativeHandler();
|
|
|
| // Create an object with bindings to the native functions defined through
|
| // RouteFunction().
|
| - virtual v8::Handle<v8::Object> NewInstance();
|
| + virtual v8::Handle<v8::Object> NewInstance() OVERRIDE;
|
|
|
| protected:
|
| typedef v8::Handle<v8::Value> (*HandlerFunc)(const v8::Arguments&);
|
| @@ -38,8 +33,8 @@ class NativeHandler {
|
| HandlerFunction;
|
|
|
| // Installs a new 'route' from |name| to |handler_function|. This means that
|
| - // NewInstance()s of this NativeHandler will have a property |name| which
|
| - // will be handled by |handler_function|.
|
| + // NewInstance()s of this ObjectBackedNativeHandler will have a property
|
| + // |name| which will be handled by |handler_function|.
|
| void RouteFunction(const std::string& name,
|
| const HandlerFunction& handler_function);
|
|
|
| @@ -53,9 +48,9 @@ class NativeHandler {
|
| v8::Isolate* isolate_;
|
| v8::Persistent<v8::ObjectTemplate> object_template_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(NativeHandler);
|
| + DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler);
|
| };
|
|
|
| } // extensions
|
|
|
| -#endif // CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
|
| +#endif // CHROME_RENDERER_EXTENSIONS_OBJECT_BACKED_NATIVE_HANDLER_H_
|
|
|