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 "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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); |
| 263 if (!instance_object || !instance_object->container()) | 263 if (!instance_object) |
| 264 return GURL(); | 264 return GURL(); |
| 265 | 265 |
| 266 return instance_object->container()->element().document().url(); | 266 blink::WebPluginContainer* container = instance_object->container(); |
| 267 if (!container) | |
| 268 return GURL(); | |
|
bbudge
2015/03/16 21:50:33
You could replace the lines above with a single ca
dmichael (off chromium)
2015/03/16 21:57:16
Good call, done.
| |
| 269 | |
| 270 blink::WebElement element = container->element(); | |
| 271 if (element.isNull()) | |
| 272 return GURL(); | |
| 273 | |
| 274 blink::WebDocument document = element.document(); | |
| 275 if (document.isNull()) | |
| 276 return GURL(); | |
|
bbudge
2015/03/16 21:50:33
Are you sure we need these checks? There are a bun
dmichael (off chromium)
2015/03/16 21:57:16
Absolutely not sure. I don't know how we can get i
bbudge
2015/03/16 22:11:29
Looking at other usages, it seems unlikely, but OK
dmichael (off chromium)
2015/03/16 22:16:48
I agree with you. I'm partly doing this to get mor
| |
| 277 | |
| 278 return document.url(); | |
| 267 } | 279 } |
| 268 | 280 |
| 269 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( | 281 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( |
| 270 PP_Instance pp_instance) const { | 282 PP_Instance pp_instance) const { |
| 271 PepperPluginInstanceImpl* instance = | 283 PepperPluginInstanceImpl* instance = |
| 272 HostGlobals::Get()->GetInstance(pp_instance); | 284 HostGlobals::Get()->GetInstance(pp_instance); |
| 273 if (!instance) | 285 if (!instance) |
| 274 return NULL; | 286 return NULL; |
| 275 if (!instance->IsValidInstanceOf(module_)) | 287 if (!instance->IsValidInstanceOf(module_)) |
| 276 return NULL; | 288 return NULL; |
| 277 return instance; | 289 return instance; |
| 278 } | 290 } |
| 279 | 291 |
| 280 } // namespace content | 292 } // namespace content |
| OLD | NEW |