| OLD | NEW |
| 1 // Copyright (c) 2009 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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 DLOG(INFO) << StringPrintf("Deleted request. Obj: %X", this); | 34 DLOG(INFO) << StringPrintf("Deleted request. Obj: %X", this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool UrlmonUrlRequest::Start() { | 37 bool UrlmonUrlRequest::Start() { |
| 38 thread_ = PlatformThread::CurrentId(); | 38 thread_ = PlatformThread::CurrentId(); |
| 39 status_.Start(); | 39 status_.Start(); |
| 40 // The UrlmonUrlRequest instance can get destroyed in the context of | 40 // The UrlmonUrlRequest instance can get destroyed in the context of |
| 41 // StartAsyncDownload if BindToStorage finishes synchronously with an error. | 41 // StartAsyncDownload if BindToStorage finishes synchronously with an error. |
| 42 // Grab a reference to protect against this. | 42 // Grab a reference to protect against this. |
| 43 scoped_refptr<UrlmonUrlRequest> ref(this); | 43 scoped_refptr<UrlmonUrlRequest> ref(this); |
| 44 HRESULT hr = E_UNEXPECTED; | 44 HRESULT hr = StartAsyncDownload(); |
| 45 if (request_data_) { | |
| 46 DCHECK(bind_context_ == NULL); | |
| 47 hr = CreateAsyncBindCtxEx(NULL, 0, this, NULL, bind_context_.Receive(), 0); | |
| 48 DCHECK(SUCCEEDED(hr)); | |
| 49 CComObject<SimpleBindingImpl>* binding = NULL; | |
| 50 CComObject<SimpleBindingImpl>::CreateInstance(&binding); | |
| 51 binding->AddRef(); | |
| 52 hr = MonikerPatch::BindToStorageFromCache(bind_context_, NULL, | |
| 53 request_data_, binding, NULL); | |
| 54 binding->Release(); | |
| 55 } else { | |
| 56 hr = StartAsyncDownload(); | |
| 57 } | |
| 58 | |
| 59 if (FAILED(hr) && status_.get_state() != UrlmonUrlRequest::Status::DONE) { | 45 if (FAILED(hr) && status_.get_state() != UrlmonUrlRequest::Status::DONE) { |
| 60 status_.Done(); | 46 status_.Done(); |
| 61 status_.set_result(URLRequestStatus::FAILED, HresultToNetError(hr)); | 47 status_.set_result(URLRequestStatus::FAILED, HresultToNetError(hr)); |
| 62 NotifyDelegateAndDie(); | 48 NotifyDelegateAndDie(); |
| 63 } | 49 } |
| 64 return true; | 50 return true; |
| 65 } | 51 } |
| 66 | 52 |
| 67 void UrlmonUrlRequest::Stop() { | 53 void UrlmonUrlRequest::Stop() { |
| 68 DCHECK_EQ(thread_, PlatformThread::CurrentId()); | 54 DCHECK_EQ(thread_, PlatformThread::CurrentId()); |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 | 1176 |
| 1191 privacy_entry.flags |= flags; | 1177 privacy_entry.flags |= flags; |
| 1192 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1178 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
| 1193 | 1179 |
| 1194 if (fire_privacy_event && IsWindow(notification_window_)) { | 1180 if (fire_privacy_event && IsWindow(notification_window_)) { |
| 1195 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1181 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
| 1196 0); | 1182 0); |
| 1197 } | 1183 } |
| 1198 } | 1184 } |
| 1199 | 1185 |
| OLD | NEW |