Extensions: pass ChromeV8Context around instead of v8::Handle.

There was a TODO about this in object_backed_native_handler.h.

The passed handle was a Persistent behind the scenes, and we're going to disable
copying Persistents. We'd need to pass a Local handle instead, but this way the
TODO gets done with a similar amount of effort.

BUG=236290

Review URL: https://chromiumcodereview.appspot.com/16032015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203978 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/extensions/object_backed_native_handler.h b/chrome/renderer/extensions/object_backed_native_handler.h
index 0439adfe..78e893d 100644
--- a/chrome/renderer/extensions/object_backed_native_handler.h
+++ b/chrome/renderer/extensions/object_backed_native_handler.h
@@ -15,13 +15,14 @@
 #include "v8/include/v8.h"
 
 namespace extensions {
+class ChromeV8Context;
 
 // 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 ObjectBackedNativeHandler(v8::Handle<v8::Context> context);
+  explicit ObjectBackedNativeHandler(ChromeV8Context* context);
   virtual ~ObjectBackedNativeHandler();
 
   // Create an object with bindings to the native functions defined through
@@ -38,7 +39,7 @@
   void RouteFunction(const std::string& name,
                      const HandlerFunction& handler_function);
 
-  v8::Handle<v8::Context> v8_context() { return v8_context_.get(); }
+  ChromeV8Context* context() { return context_; }
 
   virtual void Invalidate() OVERRIDE;
 
@@ -63,9 +64,7 @@
   typedef std::vector<v8::Persistent<v8::Object> > RouterData;
   RouterData router_data_;
 
-  // TODO(kalman): Just pass around a ChromeV8Context. It already has a
-  // persistent handle to this context.
-  ScopedPersistent<v8::Context> v8_context_;
+  ChromeV8Context* context_;
 
   ScopedPersistent<v8::ObjectTemplate> object_template_;