| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 base::MessageLoop::current()->PostTask( | 252 base::MessageLoop::current()->PostTask( |
| 253 FROM_HERE, | 253 FROM_HERE, |
| 254 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); | 254 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); |
| 255 } else { | 255 } else { |
| 256 browser_connection->SendBrowserCreate( | 256 browser_connection->SendBrowserCreate( |
| 257 module_->GetPluginChildId(), instance, nested_msgs, callback); | 257 module_->GetPluginChildId(), instance, nested_msgs, callback); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const { | 261 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const { |
| 262 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); | 262 blink::WebPluginContainer* container = GetContainerForInstance(instance); |
| 263 if (!instance_object || !instance_object->container()) | 263 if (!container) |
| 264 return GURL(); | 264 return GURL(); |
| 265 | 265 |
| 266 return instance_object->container()->element().document().url(); | 266 blink::WebElement element = container->element(); |
| 267 if (element.isNull()) |
| 268 return GURL(); |
| 269 |
| 270 blink::WebDocument document = element.document(); |
| 271 if (document.isNull()) |
| 272 return GURL(); |
| 273 |
| 274 return document.url(); |
| 267 } | 275 } |
| 268 | 276 |
| 269 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( | 277 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( |
| 270 PP_Instance pp_instance) const { | 278 PP_Instance pp_instance) const { |
| 271 PepperPluginInstanceImpl* instance = | 279 PepperPluginInstanceImpl* instance = |
| 272 HostGlobals::Get()->GetInstance(pp_instance); | 280 HostGlobals::Get()->GetInstance(pp_instance); |
| 273 if (!instance) | 281 if (!instance) |
| 274 return NULL; | 282 return NULL; |
| 275 if (!instance->IsValidInstanceOf(module_)) | 283 if (!instance->IsValidInstanceOf(module_)) |
| 276 return NULL; | 284 return NULL; |
| 277 return instance; | 285 return instance; |
| 278 } | 286 } |
| 279 | 287 |
| 280 } // namespace content | 288 } // namespace content |
| OLD | NEW |