OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/http/url_security_manager.h" | 5 #include "net/http/url_security_manager.h" |
6 | 6 |
7 #include <urlmon.h> | 7 #include <urlmon.h> |
8 #pragma comment(lib, "urlmon.lib") | 8 #pragma comment(lib, "urlmon.lib") |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 bool URLSecurityManagerWin::CanDelegate(const GURL& auth_origin) const { | 105 bool URLSecurityManagerWin::CanDelegate(const GURL& auth_origin) const { |
106 // TODO(cbentzel): Could this just use the security zone as well? Apparently | 106 // TODO(cbentzel): Could this just use the security zone as well? Apparently |
107 // this is what IE does as well. | 107 // this is what IE does as well. |
108 if (whitelist_delegate_.get()) | 108 if (whitelist_delegate_.get()) |
109 return whitelist_delegate_->IsValid(auth_origin, HttpAuth::AUTH_SERVER); | 109 return whitelist_delegate_->IsValid(auth_origin, HttpAuth::AUTH_SERVER); |
110 return false; | 110 return false; |
111 } | 111 } |
112 | 112 |
113 bool URLSecurityManagerWin::EnsureSystemSecurityManager() { | 113 bool URLSecurityManagerWin::EnsureSystemSecurityManager() { |
114 if (!security_manager_) { | 114 if (!security_manager_.get()) { |
115 HRESULT hr = CoInternetCreateSecurityManager(NULL, | 115 HRESULT hr = CoInternetCreateSecurityManager(NULL, |
116 security_manager_.Receive(), | 116 security_manager_.Receive(), |
117 NULL); | 117 NULL); |
118 if (FAILED(hr) || !security_manager_) { | 118 if (FAILED(hr) || !security_manager_.get()) { |
119 LOG(ERROR) << "Unable to create the Windows Security Manager instance"; | 119 LOG(ERROR) << "Unable to create the Windows Security Manager instance"; |
120 return false; | 120 return false; |
121 } | 121 } |
122 } | 122 } |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 // static | 126 // static |
127 URLSecurityManager* URLSecurityManager::Create( | 127 URLSecurityManager* URLSecurityManager::Create( |
128 const HttpAuthFilter* whitelist_default, | 128 const HttpAuthFilter* whitelist_default, |
129 const HttpAuthFilter* whitelist_delegate) { | 129 const HttpAuthFilter* whitelist_delegate) { |
130 // If we have a whitelist, just use that. | 130 // If we have a whitelist, just use that. |
131 if (whitelist_default) | 131 if (whitelist_default) |
132 return new URLSecurityManagerWhitelist(whitelist_default, | 132 return new URLSecurityManagerWhitelist(whitelist_default, |
133 whitelist_delegate); | 133 whitelist_delegate); |
134 return new URLSecurityManagerWin(whitelist_delegate); | 134 return new URLSecurityManagerWin(whitelist_delegate); |
135 } | 135 } |
136 | 136 |
137 } // namespace net | 137 } // namespace net |
OLD | NEW |