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 21 matching lines...) Expand all Loading... |
32 size_to_write); | 32 size_to_write); |
33 if (size_written) | 33 if (size_written) |
34 *size_written = size_to_write; | 34 *size_written = size_to_write; |
35 return S_OK; | 35 return S_OK; |
36 } | 36 } |
37 | 37 |
38 UrlmonUrlRequest::UrlmonUrlRequest() | 38 UrlmonUrlRequest::UrlmonUrlRequest() |
39 : pending_read_size_(0), | 39 : pending_read_size_(0), |
40 headers_received_(false), | 40 headers_received_(false), |
41 thread_(NULL), | 41 thread_(NULL), |
42 parent_window_(NULL) { | 42 parent_window_(NULL), |
| 43 privileged_mode_(false) { |
43 DLOG(INFO) << StringPrintf("Created request. Obj: %X", this); | 44 DLOG(INFO) << StringPrintf("Created request. Obj: %X", this); |
44 } | 45 } |
45 | 46 |
46 UrlmonUrlRequest::~UrlmonUrlRequest() { | 47 UrlmonUrlRequest::~UrlmonUrlRequest() { |
47 DLOG(INFO) << StringPrintf("Deleted request. Obj: %X", this); | 48 DLOG(INFO) << StringPrintf("Deleted request. Obj: %X", this); |
48 } | 49 } |
49 | 50 |
50 bool UrlmonUrlRequest::Start() { | 51 bool UrlmonUrlRequest::Start() { |
51 thread_ = PlatformThread::CurrentId(); | 52 thread_ = PlatformThread::CurrentId(); |
52 status_.Start(); | 53 status_.Start(); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 // TODO(iyengar): This hits when running the URL request tests. | 540 // TODO(iyengar): This hits when running the URL request tests. |
540 DLOG_IF(ERROR, !::IsWindow(parent_window_)) | 541 DLOG_IF(ERROR, !::IsWindow(parent_window_)) |
541 << "UrlmonUrlRequest::GetWindow - no window!"; | 542 << "UrlmonUrlRequest::GetWindow - no window!"; |
542 *parent_window = parent_window_; | 543 *parent_window = parent_window_; |
543 return S_OK; | 544 return S_OK; |
544 } | 545 } |
545 | 546 |
546 STDMETHODIMP UrlmonUrlRequest::Authenticate(HWND* parent_window, | 547 STDMETHODIMP UrlmonUrlRequest::Authenticate(HWND* parent_window, |
547 LPWSTR* user_name, | 548 LPWSTR* user_name, |
548 LPWSTR* password) { | 549 LPWSTR* password) { |
549 if (!parent_window) { | 550 if (!parent_window) |
550 return E_INVALIDARG; | 551 return E_INVALIDARG; |
551 } | 552 |
| 553 if (privileged_mode_) |
| 554 return E_FAIL; |
552 | 555 |
553 DCHECK(::IsWindow(parent_window_)); | 556 DCHECK(::IsWindow(parent_window_)); |
554 *parent_window = parent_window_; | 557 *parent_window = parent_window_; |
555 return S_OK; | 558 return S_OK; |
556 } | 559 } |
557 | 560 |
558 STDMETHODIMP UrlmonUrlRequest::OnSecurityProblem(DWORD problem) { | 561 STDMETHODIMP UrlmonUrlRequest::OnSecurityProblem(DWORD problem) { |
559 // Urlmon notifies the client of authentication problems, certificate | 562 // Urlmon notifies the client of authentication problems, certificate |
560 // errors, etc by querying the object implementing the IBindStatusCallback | 563 // errors, etc by querying the object implementing the IBindStatusCallback |
561 // interface for the IHttpSecurity interface. If this interface is not | 564 // interface for the IHttpSecurity interface. If this interface is not |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 | 893 |
891 new_request->Initialize(static_cast<PluginUrlRequestDelegate*>(this), | 894 new_request->Initialize(static_cast<PluginUrlRequestDelegate*>(this), |
892 request_id, | 895 request_id, |
893 request_info.url, | 896 request_info.url, |
894 request_info.method, | 897 request_info.method, |
895 request_info.referrer, | 898 request_info.referrer, |
896 request_info.extra_request_headers, | 899 request_info.extra_request_headers, |
897 request_info.upload_data, | 900 request_info.upload_data, |
898 enable_frame_busting_); | 901 enable_frame_busting_); |
899 new_request->set_parent_window(notification_window_); | 902 new_request->set_parent_window(notification_window_); |
| 903 new_request->set_privileged_mode(privileged_mode_); |
900 | 904 |
901 // Shall we use previously fetched data? | 905 // Shall we use previously fetched data? |
902 if (request_for_url.get()) { | 906 if (request_for_url.get()) { |
903 new_request->SetRequestData(request_for_url->request_data()); | 907 new_request->SetRequestData(request_for_url->request_data()); |
904 } | 908 } |
905 | 909 |
906 DCHECK(LookupRequest(request_id).get() == NULL); | 910 DCHECK(LookupRequest(request_id).get() == NULL); |
907 request_map_[request_id] = new_request; | 911 request_map_[request_id] = new_request; |
908 map_empty_.Reset(); | 912 map_empty_.Reset(); |
909 new_request->Start(); | 913 new_request->Start(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 scoped_refptr<UrlmonUrlRequest> UrlmonUrlRequestManager::LookupRequest( | 1036 scoped_refptr<UrlmonUrlRequest> UrlmonUrlRequestManager::LookupRequest( |
1033 int request_id) { | 1037 int request_id) { |
1034 RequestMap::iterator it = request_map_.find(request_id); | 1038 RequestMap::iterator it = request_map_.find(request_id); |
1035 if (request_map_.end() != it) | 1039 if (request_map_.end() != it) |
1036 return it->second; | 1040 return it->second; |
1037 return NULL; | 1041 return NULL; |
1038 } | 1042 } |
1039 | 1043 |
1040 UrlmonUrlRequestManager::UrlmonUrlRequestManager() | 1044 UrlmonUrlRequestManager::UrlmonUrlRequestManager() |
1041 : stopping_(false), worker_thread_("UrlMon fetch thread"), | 1045 : stopping_(false), worker_thread_("UrlMon fetch thread"), |
1042 map_empty_(true, true), notification_window_(NULL) { | 1046 map_empty_(true, true), notification_window_(NULL), |
| 1047 privileged_mode_(false) { |
1043 } | 1048 } |
1044 | 1049 |
1045 UrlmonUrlRequestManager::~UrlmonUrlRequestManager() { | 1050 UrlmonUrlRequestManager::~UrlmonUrlRequestManager() { |
1046 StopAll(); | 1051 StopAll(); |
1047 } | 1052 } |
1048 | 1053 |
1049 // Called from UI thread. | 1054 // Called from UI thread. |
1050 void UrlmonUrlRequestManager::StealMonikerFromRequest(int request_id, | 1055 void UrlmonUrlRequestManager::StealMonikerFromRequest(int request_id, |
1051 IMoniker** moniker) { | 1056 IMoniker** moniker) { |
1052 base::WaitableEvent done(true, false); | 1057 base::WaitableEvent done(true, false); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 privacy_entry.flags |= flags; | 1116 privacy_entry.flags |= flags; |
1112 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1117 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
1113 } | 1118 } |
1114 | 1119 |
1115 if (fire_privacy_event && IsWindow(notification_window_)) { | 1120 if (fire_privacy_event && IsWindow(notification_window_)) { |
1116 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1121 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
1117 0); | 1122 0); |
1118 } | 1123 } |
1119 } | 1124 } |
1120 | 1125 |
OLD | NEW |