Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 } | 63 } |
| 64 | 64 |
| 65 void RuntimeCustomBindings::OpenChannelToNativeApp( | 65 void RuntimeCustomBindings::OpenChannelToNativeApp( |
| 66 const v8::FunctionCallbackInfo<v8::Value>& args) { | 66 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 67 // Verify that the extension has permission to use native messaging. | 67 // Verify that the extension has permission to use native messaging. |
| 68 if (!BaseFeatureProvider::GetByName("permission")->GetFeature( | 68 if (!BaseFeatureProvider::GetByName("permission")->GetFeature( |
| 69 "nativeMessaging")->IsAvailableToContext( | 69 "nativeMessaging")->IsAvailableToContext( |
| 70 GetExtensionForRenderView(), | 70 GetExtensionForRenderView(), |
| 71 context()->context_type(), | 71 context()->context_type(), |
| 72 context()->GetURL()).is_available()) { | 72 context()->GetURL()).is_available()) { |
| 73 APIActivityLogger::LogBlockedCall(context()->extension()->id(), | |
| 74 "nativeMessaging"); | |
|
not at google - send to devlin
2013/07/11 19:22:33
Ok, maybe we should add a utility to ChromeV8Conte
felt
2013/07/11 19:26:37
Sorry, not 100% sure what you mean here -- add a m
not at google - send to devlin
2013/07/11 19:28:02
Yep that's what I meant, do the logging in that si
felt
2013/07/12 01:53:04
Instead of adding an extra method to be a wrapper
| |
| 73 return; | 75 return; |
| 74 } | 76 } |
| 75 | 77 |
| 76 // Get the current RenderView so that we can send a routed IPC message from | 78 // Get the current RenderView so that we can send a routed IPC message from |
| 77 // the correct source. | 79 // the correct source. |
| 78 content::RenderView* renderview = GetRenderView(); | 80 content::RenderView* renderview = GetRenderView(); |
| 79 if (!renderview) | 81 if (!renderview) |
| 80 return; | 82 return; |
| 81 | 83 |
| 82 // The Javascript code should validate/fill the arguments. | 84 // The Javascript code should validate/fill the arguments. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 100 const v8::FunctionCallbackInfo<v8::Value>& args) { | 102 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 101 CHECK(context()->extension()); | 103 CHECK(context()->extension()); |
| 102 | 104 |
| 103 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 105 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 104 args.GetReturnValue().Set( | 106 args.GetReturnValue().Set( |
| 105 converter->ToV8Value(context()->extension()->manifest()->value(), | 107 converter->ToV8Value(context()->extension()->manifest()->value(), |
| 106 context()->v8_context())); | 108 context()->v8_context())); |
| 107 } | 109 } |
| 108 | 110 |
| 109 } // namespace extensions | 111 } // namespace extensions |
| OLD | NEW |