| 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); |
| 71 virtual void OnAuthRequired(URLRequest* request, | 73 virtual void OnAuthRequired(URLRequest* request, |
| 72 net::AuthChallengeInfo* auth_info); | 74 net::AuthChallengeInfo* auth_info); |
| 73 virtual void OnSSLCertificateError(URLRequest* request, | 75 virtual void OnSSLCertificateError(URLRequest* request, |
| 74 int cert_error, | 76 int cert_error, |
| 75 net::X509Certificate* cert); | 77 net::X509Certificate* cert); |
| 76 virtual void OnResponseStarted(URLRequest* request); | 78 virtual void OnResponseStarted(URLRequest* request); |
| 77 virtual void OnReadCompleted(URLRequest* request, int bytes_read); | 79 virtual void OnReadCompleted(URLRequest* request, int bytes_read); |
| 78 | 80 |
| 79 void OnDownloadCompleted(URLRequest* request); | 81 void OnDownloadCompleted(URLRequest* request); |
| 80 | 82 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 122 } |
| 121 } | 123 } |
| 122 | 124 |
| 123 void PluginDownloadUrlHelper::InitiateDownload() { | 125 void PluginDownloadUrlHelper::InitiateDownload() { |
| 124 download_file_request_= new URLRequest(GURL(download_url_), this); | 126 download_file_request_= new URLRequest(GURL(download_url_), this); |
| 125 download_file_request_->set_origin_pid(download_source_pid_); | 127 download_file_request_->set_origin_pid(download_source_pid_); |
| 126 download_file_request_->set_context(Profile::GetDefaultRequestContext()); | 128 download_file_request_->set_context(Profile::GetDefaultRequestContext()); |
| 127 download_file_request_->Start(); | 129 download_file_request_->Start(); |
| 128 } | 130 } |
| 129 | 131 |
| 132 void PluginDownloadUrlHelper::OnReceivedRedirect(URLRequest* request, |
| 133 const GURL& new_url) { |
| 134 } |
| 135 |
| 130 void PluginDownloadUrlHelper::OnAuthRequired( | 136 void PluginDownloadUrlHelper::OnAuthRequired( |
| 131 URLRequest* request, | 137 URLRequest* request, |
| 132 net::AuthChallengeInfo* auth_info) { | 138 net::AuthChallengeInfo* auth_info) { |
| 133 URLRequest::Delegate::OnAuthRequired(request, auth_info); | 139 URLRequest::Delegate::OnAuthRequired(request, auth_info); |
| 134 DownloadCompletedHelper(false); | 140 DownloadCompletedHelper(false); |
| 135 } | 141 } |
| 136 | 142 |
| 137 void PluginDownloadUrlHelper::OnSSLCertificateError( | 143 void PluginDownloadUrlHelper::OnSSLCertificateError( |
| 138 URLRequest* request, | 144 URLRequest* request, |
| 139 int cert_error, | 145 int cert_error, |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 DCHECK(MessageLoop::current() == | 564 DCHECK(MessageLoop::current() == |
| 559 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 565 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 560 | 566 |
| 561 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 567 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 562 if (chrome_plugin) { | 568 if (chrome_plugin) { |
| 563 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 569 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 564 uint32 data_len = static_cast<uint32>(data.size()); | 570 uint32 data_len = static_cast<uint32>(data.size()); |
| 565 chrome_plugin->functions().on_message(data_ptr, data_len); | 571 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 566 } | 572 } |
| 567 } | 573 } |
| OLD | NEW |