| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (!browser_connection) { | 251 if (!browser_connection) { |
| 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 pp_instance) const { |
| 262 blink::WebPluginContainer* container = GetContainerForInstance(instance); | 262 PepperPluginInstanceImpl* instance = GetAndValidateInstance(pp_instance); |
| 263 if (!container) | 263 if (!instance) |
| 264 return GURL(); | 264 return GURL(); |
| 265 | 265 return instance->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(); | |
| 275 } | 266 } |
| 276 | 267 |
| 277 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( | 268 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( |
| 278 PP_Instance pp_instance) const { | 269 PP_Instance pp_instance) const { |
| 279 PepperPluginInstanceImpl* instance = | 270 PepperPluginInstanceImpl* instance = |
| 280 HostGlobals::Get()->GetInstance(pp_instance); | 271 HostGlobals::Get()->GetInstance(pp_instance); |
| 281 if (!instance) | 272 if (!instance) |
| 282 return NULL; | 273 return NULL; |
| 283 if (!instance->IsValidInstanceOf(module_)) | 274 if (!instance->IsValidInstanceOf(module_)) |
| 284 return NULL; | 275 return NULL; |
| 285 return instance; | 276 return instance; |
| 286 } | 277 } |
| 287 | 278 |
| 288 } // namespace content | 279 } // namespace content |
| OLD | NEW |