| 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/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); | 391 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); |
| 392 ++it) { | 392 ++it) { |
| 393 document_loader->didReceiveData( | 393 document_loader->didReceiveData( |
| 394 NULL, it->c_str(), it->length(), 0 /* encoded_data_length */); | 394 NULL, it->c_str(), it->length(), 0 /* encoded_data_length */); |
| 395 } | 395 } |
| 396 if (finished_loading_) { | 396 if (finished_loading_) { |
| 397 document_loader->didFinishLoading( | 397 document_loader->didFinishLoading( |
| 398 NULL, | 398 NULL, |
| 399 0 /* finish_time */, | 399 0 /* finish_time */, |
| 400 blink::WebURLLoaderClient::kUnknownEncodedDataLength); | 400 blink::WebURLLoaderClient::kUnknownEncodedDataLength); |
| 401 } | 401 } else if (error_.get()) { |
| 402 if (error_.get()) { | 402 DCHECK(!finished_loading_); |
| 403 document_loader->didFail(NULL, *error_); | 403 document_loader->didFail(NULL, *error_); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( | 407 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( |
| 408 WebURLLoader* loader, | 408 WebURLLoader* loader, |
| 409 const char* data, | 409 const char* data, |
| 410 int data_length, | 410 int data_length, |
| 411 int encoded_data_length) { | 411 int encoded_data_length) { |
| 412 data_.push_back(std::string(data, data_length)); | 412 data_.push_back(std::string(data, data_length)); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( | 415 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( |
| 416 WebURLLoader* loader, | 416 WebURLLoader* loader, |
| 417 double finish_time, | 417 double finish_time, |
| 418 int64_t total_encoded_data_length) { | 418 int64_t total_encoded_data_length) { |
| 419 DCHECK(!finished_loading_); | 419 DCHECK(!finished_loading_); |
| 420 |
| 421 if (error_.get()) |
| 422 return; |
| 423 |
| 420 finished_loading_ = true; | 424 finished_loading_ = true; |
| 421 } | 425 } |
| 422 | 426 |
| 423 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFail( | 427 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFail( |
| 424 WebURLLoader* loader, | 428 WebURLLoader* loader, |
| 425 const WebURLError& error) { | 429 const WebURLError& error) { |
| 426 DCHECK(!error_.get()); | 430 DCHECK(!error_.get()); |
| 431 |
| 432 if (finished_loading_) |
| 433 return; |
| 434 |
| 427 error_.reset(new WebURLError(error)); | 435 error_.reset(new WebURLError(error)); |
| 428 } | 436 } |
| 429 | 437 |
| 430 PepperPluginInstanceImpl::GamepadImpl::GamepadImpl() | 438 PepperPluginInstanceImpl::GamepadImpl::GamepadImpl() |
| 431 : Resource(ppapi::Resource::Untracked()) {} | 439 : Resource(ppapi::Resource::Untracked()) {} |
| 432 | 440 |
| 433 PepperPluginInstanceImpl::GamepadImpl::~GamepadImpl() {} | 441 PepperPluginInstanceImpl::GamepadImpl::~GamepadImpl() {} |
| 434 | 442 |
| 435 PPB_Gamepad_API* PepperPluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() { | 443 PPB_Gamepad_API* PepperPluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() { |
| 436 return this; | 444 return this; |
| (...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 | 3270 |
| 3263 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { | 3271 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { |
| 3264 if (initialized_ && !javascript_used_ && is_flash_plugin_) { | 3272 if (initialized_ && !javascript_used_ && is_flash_plugin_) { |
| 3265 javascript_used_ = true; | 3273 javascript_used_ = true; |
| 3266 RenderThread::Get()->RecordAction( | 3274 RenderThread::Get()->RecordAction( |
| 3267 base::UserMetricsAction("Flash.JavaScriptUsed")); | 3275 base::UserMetricsAction("Flash.JavaScriptUsed")); |
| 3268 } | 3276 } |
| 3269 } | 3277 } |
| 3270 | 3278 |
| 3271 } // namespace content | 3279 } // namespace content |
| OLD | NEW |