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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 class PluginDownloadUrlHelper : public URLRequest::Delegate { | 74 class PluginDownloadUrlHelper : public URLRequest::Delegate { |
75 static const int kDownloadFileBufferSize = 32768; | 75 static const int kDownloadFileBufferSize = 32768; |
76 public: | 76 public: |
77 PluginDownloadUrlHelper(const std::string& download_url, | 77 PluginDownloadUrlHelper(const std::string& download_url, |
78 int source_pid, gfx::NativeWindow caller_window); | 78 int source_pid, gfx::NativeWindow caller_window); |
79 ~PluginDownloadUrlHelper(); | 79 ~PluginDownloadUrlHelper(); |
80 | 80 |
81 void InitiateDownload(); | 81 void InitiateDownload(); |
82 | 82 |
83 // URLRequest::Delegate | 83 // URLRequest::Delegate |
84 virtual void OnReceivedRedirect(URLRequest* request, | |
85 const GURL& new_url); | |
86 virtual void OnAuthRequired(URLRequest* request, | 84 virtual void OnAuthRequired(URLRequest* request, |
87 net::AuthChallengeInfo* auth_info); | 85 net::AuthChallengeInfo* auth_info); |
88 virtual void OnSSLCertificateError(URLRequest* request, | 86 virtual void OnSSLCertificateError(URLRequest* request, |
89 int cert_error, | 87 int cert_error, |
90 net::X509Certificate* cert); | 88 net::X509Certificate* cert); |
91 virtual void OnResponseStarted(URLRequest* request); | 89 virtual void OnResponseStarted(URLRequest* request); |
92 virtual void OnReadCompleted(URLRequest* request, int bytes_read); | 90 virtual void OnReadCompleted(URLRequest* request, int bytes_read); |
93 | 91 |
94 void OnDownloadCompleted(URLRequest* request); | 92 void OnDownloadCompleted(URLRequest* request); |
95 | 93 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 133 } |
136 } | 134 } |
137 | 135 |
138 void PluginDownloadUrlHelper::InitiateDownload() { | 136 void PluginDownloadUrlHelper::InitiateDownload() { |
139 download_file_request_= new URLRequest(GURL(download_url_), this); | 137 download_file_request_= new URLRequest(GURL(download_url_), this); |
140 download_file_request_->set_origin_pid(download_source_pid_); | 138 download_file_request_->set_origin_pid(download_source_pid_); |
141 download_file_request_->set_context(Profile::GetDefaultRequestContext()); | 139 download_file_request_->set_context(Profile::GetDefaultRequestContext()); |
142 download_file_request_->Start(); | 140 download_file_request_->Start(); |
143 } | 141 } |
144 | 142 |
145 void PluginDownloadUrlHelper::OnReceivedRedirect(URLRequest* request, | |
146 const GURL& new_url) { | |
147 } | |
148 | |
149 void PluginDownloadUrlHelper::OnAuthRequired( | 143 void PluginDownloadUrlHelper::OnAuthRequired( |
150 URLRequest* request, | 144 URLRequest* request, |
151 net::AuthChallengeInfo* auth_info) { | 145 net::AuthChallengeInfo* auth_info) { |
152 URLRequest::Delegate::OnAuthRequired(request, auth_info); | 146 URLRequest::Delegate::OnAuthRequired(request, auth_info); |
153 DownloadCompletedHelper(false); | 147 DownloadCompletedHelper(false); |
154 } | 148 } |
155 | 149 |
156 void PluginDownloadUrlHelper::OnSSLCertificateError( | 150 void PluginDownloadUrlHelper::OnSSLCertificateError( |
157 URLRequest* request, | 151 URLRequest* request, |
158 int cert_error, | 152 int cert_error, |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 DCHECK(MessageLoop::current() == | 583 DCHECK(MessageLoop::current() == |
590 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 584 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
591 | 585 |
592 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 586 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
593 if (chrome_plugin) { | 587 if (chrome_plugin) { |
594 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 588 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
595 uint32 data_len = static_cast<uint32>(data.size()); | 589 uint32 data_len = static_cast<uint32>(data.size()); |
596 chrome_plugin->functions().on_message(data_ptr, data_len); | 590 chrome_plugin->functions().on_message(data_ptr, data_len); |
597 } | 591 } |
598 } | 592 } |
OLD | NEW |