| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome_frame/urlmon_url_request.h" | 5 #include "chrome_frame/urlmon_url_request.h" |
| 6 | 6 |
| 7 #include <wininet.h> | 7 #include <wininet.h> |
| 8 #include <urlmon.h> | 8 #include <urlmon.h> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool UrlmonUrlRequest::Read(int bytes_to_read) { | 115 bool UrlmonUrlRequest::Read(int bytes_to_read) { |
| 116 DCHECK_EQ(thread_, PlatformThread::CurrentId()); | 116 DCHECK_EQ(thread_, PlatformThread::CurrentId()); |
| 117 DCHECK_GE(bytes_to_read, 0); | 117 DCHECK_GE(bytes_to_read, 0); |
| 118 DCHECK_EQ(0, calling_delegate_); | 118 DCHECK_EQ(0, calling_delegate_); |
| 119 DLOG(INFO) << __FUNCTION__ << me(); | 119 DLOG(INFO) << __FUNCTION__ << me(); |
| 120 | 120 |
| 121 // Re-entrancy check. Thou shall not call Read() while process OnReadComplete! | 121 // Re-entrancy check. Thou shall not call Read() while process OnReadComplete! |
| 122 DCHECK_EQ(0u, pending_read_size_); | 122 DCHECK_EQ(0, pending_read_size_); |
| 123 if (pending_read_size_ != 0) | 123 if (pending_read_size_ != 0) |
| 124 return false; | 124 return false; |
| 125 | 125 |
| 126 DCHECK((status_.get_state() != Status::DONE) == (binding_ != NULL)); | 126 DCHECK((status_.get_state() != Status::DONE) == (binding_ != NULL)); |
| 127 if (status_.get_state() == Status::ABORTING) { | 127 if (status_.get_state() == Status::ABORTING) { |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Send data if available. | 131 // Send data if available. |
| 132 size_t bytes_copied = 0; | 132 size_t bytes_copied = 0; |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 --calling_delegate_; | 1129 --calling_delegate_; |
| 1130 DLOG(INFO) << __FUNCTION__ << " done id: " << request_id; | 1130 DLOG(INFO) << __FUNCTION__ << " done id: " << request_id; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void UrlmonUrlRequestManager::OnResponseEnd(int request_id, | 1133 void UrlmonUrlRequestManager::OnResponseEnd(int request_id, |
| 1134 const URLRequestStatus& status) { | 1134 const URLRequestStatus& status) { |
| 1135 DCHECK_NE(request_id, -1); | 1135 DCHECK_NE(request_id, -1); |
| 1136 DLOG(INFO) << __FUNCTION__; | 1136 DLOG(INFO) << __FUNCTION__; |
| 1137 DCHECK(status.status() != URLRequestStatus::CANCELED); | 1137 DCHECK(status.status() != URLRequestStatus::CANCELED); |
| 1138 RequestMap::size_type n = request_map_.erase(request_id); | 1138 RequestMap::size_type n = request_map_.erase(request_id); |
| 1139 DCHECK_EQ(1u, n); | 1139 DCHECK_EQ(1, n); |
| 1140 ++calling_delegate_; | 1140 ++calling_delegate_; |
| 1141 delegate_->OnResponseEnd(request_id, status); | 1141 delegate_->OnResponseEnd(request_id, status); |
| 1142 --calling_delegate_; | 1142 --calling_delegate_; |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 void UrlmonUrlRequestManager::OnCookiesRetrieved(bool success, const GURL& url, | 1145 void UrlmonUrlRequestManager::OnCookiesRetrieved(bool success, const GURL& url, |
| 1146 const std::string& cookie_string, int cookie_id) { | 1146 const std::string& cookie_string, int cookie_id) { |
| 1147 DCHECK(url.is_valid()); | 1147 DCHECK(url.is_valid()); |
| 1148 delegate_->OnCookiesRetrieved(success, url, cookie_string, cookie_id); | 1148 delegate_->OnCookiesRetrieved(success, url, cookie_string, cookie_id); |
| 1149 } | 1149 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 privacy_info_.privacy_records[UTF8ToWide(url)]; | 1189 privacy_info_.privacy_records[UTF8ToWide(url)]; |
| 1190 | 1190 |
| 1191 privacy_entry.flags |= flags; | 1191 privacy_entry.flags |= flags; |
| 1192 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1192 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
| 1193 | 1193 |
| 1194 if (fire_privacy_event && IsWindow(notification_window_)) { | 1194 if (fire_privacy_event && IsWindow(notification_window_)) { |
| 1195 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1195 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
| 1196 0); | 1196 0); |
| 1197 } | 1197 } |
| 1198 } | 1198 } |
| OLD | NEW |