| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/plugin_process_host.h" | 7 #include "chrome/browser/plugin_process_host.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 class PluginDownloadUrlHelper : public URLRequest::Delegate { | 61 class PluginDownloadUrlHelper : public URLRequest::Delegate { |
| 62 static const int kDownloadFileBufferSize = 32768; | 62 static const int kDownloadFileBufferSize = 32768; |
| 63 public: | 63 public: |
| 64 PluginDownloadUrlHelper(const std::string& download_url, | 64 PluginDownloadUrlHelper(const std::string& download_url, |
| 65 int source_pid, gfx::NativeWindow caller_window); | 65 int source_pid, gfx::NativeWindow caller_window); |
| 66 ~PluginDownloadUrlHelper(); | 66 ~PluginDownloadUrlHelper(); |
| 67 | 67 |
| 68 void InitiateDownload(); | 68 void InitiateDownload(); |
| 69 | 69 |
| 70 // URLRequest::Delegate | 70 // URLRequest::Delegate |
| 71 virtual void OnReceivedRedirect(URLRequest* request, | |
| 72 const GURL& new_url); | |
| 73 virtual void OnAuthRequired(URLRequest* request, | 71 virtual void OnAuthRequired(URLRequest* request, |
| 74 net::AuthChallengeInfo* auth_info); | 72 net::AuthChallengeInfo* auth_info); |
| 75 virtual void OnSSLCertificateError(URLRequest* request, | 73 virtual void OnSSLCertificateError(URLRequest* request, |
| 76 int cert_error, | 74 int cert_error, |
| 77 net::X509Certificate* cert); | 75 net::X509Certificate* cert); |
| 78 virtual void OnResponseStarted(URLRequest* request); | 76 virtual void OnResponseStarted(URLRequest* request); |
| 79 virtual void OnReadCompleted(URLRequest* request, int bytes_read); | 77 virtual void OnReadCompleted(URLRequest* request, int bytes_read); |
| 80 | 78 |
| 81 void OnDownloadCompleted(URLRequest* request); | 79 void OnDownloadCompleted(URLRequest* request); |
| 82 | 80 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 120 } |
| 123 } | 121 } |
| 124 | 122 |
| 125 void PluginDownloadUrlHelper::InitiateDownload() { | 123 void PluginDownloadUrlHelper::InitiateDownload() { |
| 126 download_file_request_= new URLRequest(GURL(download_url_), this); | 124 download_file_request_= new URLRequest(GURL(download_url_), this); |
| 127 download_file_request_->set_origin_pid(download_source_pid_); | 125 download_file_request_->set_origin_pid(download_source_pid_); |
| 128 download_file_request_->set_context(Profile::GetDefaultRequestContext()); | 126 download_file_request_->set_context(Profile::GetDefaultRequestContext()); |
| 129 download_file_request_->Start(); | 127 download_file_request_->Start(); |
| 130 } | 128 } |
| 131 | 129 |
| 132 void PluginDownloadUrlHelper::OnReceivedRedirect(URLRequest* request, | |
| 133 const GURL& new_url) { | |
| 134 } | |
| 135 | |
| 136 void PluginDownloadUrlHelper::OnAuthRequired( | 130 void PluginDownloadUrlHelper::OnAuthRequired( |
| 137 URLRequest* request, | 131 URLRequest* request, |
| 138 net::AuthChallengeInfo* auth_info) { | 132 net::AuthChallengeInfo* auth_info) { |
| 139 URLRequest::Delegate::OnAuthRequired(request, auth_info); | 133 URLRequest::Delegate::OnAuthRequired(request, auth_info); |
| 140 DownloadCompletedHelper(false); | 134 DownloadCompletedHelper(false); |
| 141 } | 135 } |
| 142 | 136 |
| 143 void PluginDownloadUrlHelper::OnSSLCertificateError( | 137 void PluginDownloadUrlHelper::OnSSLCertificateError( |
| 144 URLRequest* request, | 138 URLRequest* request, |
| 145 int cert_error, | 139 int cert_error, |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 DCHECK(MessageLoop::current() == | 558 DCHECK(MessageLoop::current() == |
| 565 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 559 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 566 | 560 |
| 567 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 561 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 568 if (chrome_plugin) { | 562 if (chrome_plugin) { |
| 569 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 563 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 570 uint32 data_len = static_cast<uint32>(data.size()); | 564 uint32 data_len = static_cast<uint32>(data.size()); |
| 571 chrome_plugin->functions().on_message(data_ptr, data_len); | 565 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 572 } | 566 } |
| 573 } | 567 } |
| OLD | NEW |