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 "content/renderer/pepper/renderer_ppapi_host_impl.h" | 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 base::MessageLoop::current()->PostTask(FROM_HERE, | 238 base::MessageLoop::current()->PostTask(FROM_HERE, |
239 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); | 239 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); |
240 } else { | 240 } else { |
241 browser_connection->SendBrowserCreate(module_->GetPluginChildId(), | 241 browser_connection->SendBrowserCreate(module_->GetPluginChildId(), |
242 instance, | 242 instance, |
243 nested_msgs, | 243 nested_msgs, |
244 callback); | 244 callback); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
| 248 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const { |
| 249 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); |
| 250 if (!instance_object) |
| 251 return GURL(); |
| 252 |
| 253 return instance_object->container()->element().document().url(); |
| 254 } |
| 255 |
248 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( | 256 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( |
249 PP_Instance pp_instance) const { | 257 PP_Instance pp_instance) const { |
250 PepperPluginInstanceImpl* instance = | 258 PepperPluginInstanceImpl* instance = |
251 HostGlobals::Get()->GetInstance(pp_instance); | 259 HostGlobals::Get()->GetInstance(pp_instance); |
252 if (!instance) | 260 if (!instance) |
253 return NULL; | 261 return NULL; |
254 if (!instance->IsValidInstanceOf(module_)) | 262 if (!instance->IsValidInstanceOf(module_)) |
255 return NULL; | 263 return NULL; |
256 return instance; | 264 return instance; |
257 } | 265 } |
258 | 266 |
259 } // namespace content | 267 } // namespace content |
OLD | NEW |