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

Side by Side Diff: chrome/renderer/extensions/runtime_custom_bindings.cc

Issue 11968028: Remove connect message from Native Messaging API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/renderer/extensions/runtime_custom_bindings.h" 5 #include "chrome/renderer/extensions/runtime_custom_bindings.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // static 59 // static
60 v8::Handle<v8::Value> RuntimeCustomBindings::OpenChannelToNativeApp( 60 v8::Handle<v8::Value> RuntimeCustomBindings::OpenChannelToNativeApp(
61 const v8::Arguments& args) { 61 const v8::Arguments& args) {
62 // Get the current RenderView so that we can send a routed IPC message from 62 // Get the current RenderView so that we can send a routed IPC message from
63 // the correct source. 63 // the correct source.
64 content::RenderView* renderview = GetCurrentRenderView(); 64 content::RenderView* renderview = GetCurrentRenderView();
65 if (!renderview) 65 if (!renderview)
66 return v8::Undefined(); 66 return v8::Undefined();
67 67
68 // The Javascript code should validate/fill the arguments. 68 // The Javascript code should validate/fill the arguments.
69 CHECK(args.Length() >= 3 && 69 CHECK(args.Length() >= 2 &&
70 args[0]->IsString() && 70 args[0]->IsString() &&
71 args[1]->IsString() && 71 args[1]->IsString());
72 args[2]->IsString() &&
73 args[3]->IsString());
74 72
75 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); 73 std::string extension_id = *v8::String::Utf8Value(args[0]->ToString());
76 std::string native_app_name = *v8::String::Utf8Value(args[1]->ToString()); 74 std::string native_app_name = *v8::String::Utf8Value(args[1]->ToString());
77 std::string channel_name = *v8::String::Utf8Value(args[2]->ToString());
78 std::string connect_message = *v8::String::Utf8Value(args[3]->ToString());
79 75
80 int port_id = -1; 76 int port_id = -1;
81 renderview->Send(new ExtensionHostMsg_OpenChannelToNativeApp( 77 renderview->Send(new ExtensionHostMsg_OpenChannelToNativeApp(
82 renderview->GetRoutingID(), 78 renderview->GetRoutingID(),
83 extension_id, 79 extension_id,
84 native_app_name, 80 native_app_name,
85 channel_name,
86 connect_message,
87 &port_id)); 81 &port_id));
88 return v8::Integer::New(port_id); 82 return v8::Integer::New(port_id);
89 } 83 }
90 84
91 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest( 85 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest(
92 const v8::Arguments& args) { 86 const v8::Arguments& args) {
93 CHECK(context_->extension()); 87 CHECK(context_->extension());
94 88
95 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 89 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
96 return converter->ToV8Value(context_->extension()->manifest()->value(), 90 return converter->ToV8Value(context_->extension()->manifest()->value(),
97 context_->v8_context()); 91 context_->v8_context());
98 } 92 }
99 93
100 } // extensions 94 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698