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

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

Issue 15091002: Lazily load API schemas from resource files and convert all APIs to features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 7 years, 6 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 std::string channel_name = *v8::String::Utf8Value(args[1]->ToString()); 57 std::string channel_name = *v8::String::Utf8Value(args[1]->ToString());
58 int port_id = -1; 58 int port_id = -1;
59 renderview->Send(new ExtensionHostMsg_OpenChannelToExtension( 59 renderview->Send(new ExtensionHostMsg_OpenChannelToExtension(
60 renderview->GetRoutingID(), info, channel_name, &port_id)); 60 renderview->GetRoutingID(), info, channel_name, &port_id));
61 return v8::Integer::New(port_id); 61 return v8::Integer::New(port_id);
62 } 62 }
63 63
64 v8::Handle<v8::Value> RuntimeCustomBindings::OpenChannelToNativeApp( 64 v8::Handle<v8::Value> RuntimeCustomBindings::OpenChannelToNativeApp(
65 const v8::Arguments& args) { 65 const v8::Arguments& args) {
66 // Verify that the extension has permission to use native messaging. 66 // Verify that the extension has permission to use native messaging.
67 if (!dispatcher()->CheckContextAccessToExtensionAPI( 67 if (!dispatcher()->CheckContextAccessToExtensionAPI(
not at google - send to devlin 2013/06/12 22:34:18 It's a bit weird seeing a permission passed into h
cduvall 2013/06/13 01:02:28 Done.
68 "nativeMessaging", context())) { 68 "permission:nativeMessaging", context())) {
69 return v8::Undefined(); 69 return v8::Undefined();
70 } 70 }
71 71
72 // Get the current RenderView so that we can send a routed IPC message from 72 // Get the current RenderView so that we can send a routed IPC message from
73 // the correct source. 73 // the correct source.
74 content::RenderView* renderview = GetRenderView(); 74 content::RenderView* renderview = GetRenderView();
75 if (!renderview) 75 if (!renderview)
76 return v8::Undefined(); 76 return v8::Undefined();
77 77
78 // The Javascript code should validate/fill the arguments. 78 // The Javascript code should validate/fill the arguments.
(...skipping 16 matching lines...) Expand all
95 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest( 95 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest(
96 const v8::Arguments& args) { 96 const v8::Arguments& args) {
97 CHECK(context()->extension()); 97 CHECK(context()->extension());
98 98
99 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 99 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
100 return converter->ToV8Value(context()->extension()->manifest()->value(), 100 return converter->ToV8Value(context()->extension()->manifest()->value(),
101 context()->v8_context()); 101 context()->v8_context());
102 } 102 }
103 103
104 } // namespace extensions 104 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698