Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: chrome/renderer/extensions/native_handler.h

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/native_handler.h
diff --git a/chrome/renderer/extensions/native_handler.h b/chrome/renderer/extensions/native_handler.h
index fd6bda69169bfb3eb39f2136bd3e1abdddb67e48..63e79e689ec0eb7a1ae65ef01834a68357c44949 100644
--- a/chrome/renderer/extensions/native_handler.h
+++ b/chrome/renderer/extensions/native_handler.h
@@ -5,55 +5,19 @@
#ifndef CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
#define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
-#include "base/bind.h"
-#include "base/memory/linked_ptr.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.
+// a single v8::Context.
// TODO(koz): Rename this to NativeJavaScriptModule.
class NativeHandler {
public:
- explicit NativeHandler(v8::Isolate* isolate);
- virtual ~NativeHandler();
-
- // Create an object with bindings to the native functions defined through
- // RouteFunction().
- virtual v8::Handle<v8::Object> NewInstance();
-
- protected:
- typedef v8::Handle<v8::Value> (*HandlerFunc)(const v8::Arguments&);
- typedef base::Callback<v8::Handle<v8::Value>(const v8::Arguments&)>
- 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|.
- void RouteFunction(const std::string& name,
- const HandlerFunction& handler_function);
-
- void RouteStaticFunction(const std::string& name,
- const HandlerFunc handler_func);
-
- private:
- static v8::Handle<v8::Value> Router(const v8::Arguments& args);
-
- std::vector<linked_ptr<HandlerFunction> > handler_functions_;
- v8::Isolate* isolate_;
- v8::Persistent<v8::ObjectTemplate> object_template_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeHandler);
+ virtual ~NativeHandler() {}
+ virtual v8::Handle<v8::Object> NewInstance() = 0;
not at google - send to devlin 2013/02/15 22:26:17 comment.
cduvall 2013/02/19 23:58:49 Done.
};
} // extensions

Powered by Google App Engine
This is Rietveld 408576698