Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/runtime_custom_bindings.h" | 5 #include "extensions/renderer/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 "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 content::RenderView* renderview = context()->GetRenderView(); | 51 content::RenderView* renderview = context()->GetRenderView(); |
| 52 if (!renderview) | 52 if (!renderview) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 // The Javascript code should validate/fill the arguments. | 55 // The Javascript code should validate/fill the arguments. |
| 56 CHECK_EQ(args.Length(), 3); | 56 CHECK_EQ(args.Length(), 3); |
| 57 CHECK(args[0]->IsString() && args[1]->IsString() && args[2]->IsBoolean()); | 57 CHECK(args[0]->IsString() && args[1]->IsString() && args[2]->IsBoolean()); |
| 58 | 58 |
| 59 ExtensionMsg_ExternalConnectionInfo info; | 59 ExtensionMsg_ExternalConnectionInfo info; |
| 60 | 60 |
| 61 if (blink::WebFrame* webframe = context()->web_frame()) | |
| 62 info.source_frame_id = !webframe->parent() ? 0 : renderview->GetRoutingID(); | |
| 63 else | |
| 64 info.source_frame_id = -1; | |
|
not at google - send to devlin
2014/11/10 18:36:42
You should be able to determine this on the browse
robwu
2014/11/10 21:43:07
I need to know whether the request originated from
not at google - send to devlin
2014/11/10 22:20:17
I'm not totally sure what you mean here, but the b
robwu
2014/11/10 23:13:38
Updated CL. I've added a new IPC message Extension
| |
| 65 | |
| 61 // For messaging APIs, hosted apps should be considered a web page so hide | 66 // For messaging APIs, hosted apps should be considered a web page so hide |
| 62 // its extension ID. | 67 // its extension ID. |
| 63 const Extension* extension = context()->extension(); | 68 const Extension* extension = context()->extension(); |
| 64 if (extension && !extension->is_hosted_app()) | 69 if (extension && !extension->is_hosted_app()) |
| 65 info.source_id = extension->id(); | 70 info.source_id = extension->id(); |
| 66 | 71 |
| 67 info.target_id = *v8::String::Utf8Value(args[0]->ToString()); | 72 info.target_id = *v8::String::Utf8Value(args[0]->ToString()); |
| 68 info.source_url = context()->GetURL(); | 73 info.source_url = context()->GetURL(); |
| 69 std::string channel_name = *v8::String::Utf8Value(args[1]->ToString()); | 74 std::string channel_name = *v8::String::Utf8Value(args[1]->ToString()); |
| 70 bool include_tls_channel_id = | 75 bool include_tls_channel_id = |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 v8::Local<v8::Value> window = context->Global(); | 175 v8::Local<v8::Value> window = context->Global(); |
| 171 DCHECK(!window.IsEmpty()); | 176 DCHECK(!window.IsEmpty()); |
| 172 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); | 177 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); |
| 173 } | 178 } |
| 174 } | 179 } |
| 175 | 180 |
| 176 args.GetReturnValue().Set(v8_views); | 181 args.GetReturnValue().Set(v8_views); |
| 177 } | 182 } |
| 178 | 183 |
| 179 } // namespace extensions | 184 } // namespace extensions |
| OLD | NEW |