Simplify atom_browser_bindings.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 22 Apr 2014 03:06:13 +0000 (11:06 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 22 Apr 2014 03:06:13 +0000 (11:06 +0800)
atom/browser/api/atom_browser_bindings.cc
atom/browser/api/atom_browser_bindings.h

index 2a69a59..b6b0ae6 100644 (file)
@@ -6,10 +6,12 @@
 
 #include <vector>
 
-#include "base/logging.h"
 #include "atom/browser/api/event.h"
-#include "atom/common/v8/native_type_conversions.h"
-#include "content/public/browser/browser_thread.h"
+#include "atom/common/native_mate_converters/string16_converter.h"
+#include "atom/common/native_mate_converters/v8_value_converter.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
 
 #include "atom/common/node_includes.h"
 
@@ -18,9 +20,6 @@ namespace atom {
 AtomBrowserBindings::AtomBrowserBindings() {
 }
 
-AtomBrowserBindings::~AtomBrowserBindings() {
-}
-
 void AtomBrowserBindings::OnRendererMessage(int process_id,
                                             int routing_id,
                                             const string16& channel,
@@ -33,7 +32,7 @@ void AtomBrowserBindings::OnRendererMessage(int process_id,
   // process.emit(channel, 'message', process_id, routing_id);
   std::vector<v8::Handle<v8::Value>> arguments;
   arguments.reserve(3 + args.GetSize());
-  arguments.push_back(ToV8Value(channel));
+  arguments.push_back(mate::ConvertToV8(node_isolate, channel));
   const base::Value* value;
   if (args.Get(0, &value))
     arguments.push_back(converter->ToV8Value(value, global_env->context()));
@@ -71,7 +70,7 @@ void AtomBrowserBindings::OnRendererMessageSync(
   // process.emit(channel, 'sync-message', event, process_id, routing_id);
   std::vector<v8::Handle<v8::Value>> arguments;
   arguments.reserve(3 + args.GetSize());
-  arguments.push_back(ToV8Value(channel));
+  arguments.push_back(mate::ConvertToV8(node_isolate, channel));
   const base::Value* value;
   if (args.Get(0, &value))
     arguments.push_back(converter->ToV8Value(value, global_env->context()));
index e015206..e967a40 100644 (file)
@@ -5,9 +5,8 @@
 #ifndef ATOM_BROWSER_API_ATOM_BROWSER_BINDINGS_H_
 #define ATOM_BROWSER_API_ATOM_BROWSER_BINDINGS_H_
 
-#include "base/strings/string16.h"
 #include "atom/common/api/atom_bindings.h"
-#include "atom/common/v8/scoped_persistent.h"
+#include "base/strings/string16.h"
 
 namespace base {
 class ListValue;
@@ -26,7 +25,6 @@ namespace atom {
 class AtomBrowserBindings : public AtomBindings {
  public:
   AtomBrowserBindings();
-  virtual ~AtomBrowserBindings();
 
   // Called when received a message from renderer.
   void OnRendererMessage(int process_id,