| OLD | NEW |
| 1 // Copyright (c) 2010 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/scoped_comptr_win.h" | |
| 11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/win/scoped_comptr.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "net/http/http_auth_filter.h" | 14 #include "net/http/http_auth_filter.h" |
| 15 | 15 |
| 16 // The Windows implementation of URLSecurityManager uses WinINet/IE's | 16 // The Windows implementation of URLSecurityManager uses WinINet/IE's |
| 17 // URL security zone manager. See the MSDN page "URL Security Zones" at | 17 // URL security zone manager. See the MSDN page "URL Security Zones" at |
| 18 // http://msdn.microsoft.com/en-us/library/ms537021(VS.85).aspx for more | 18 // http://msdn.microsoft.com/en-us/library/ms537021(VS.85).aspx for more |
| 19 // info on the Internet Security Manager and Internet Zone Manager objects. | 19 // info on the Internet Security Manager and Internet Zone Manager objects. |
| 20 // | 20 // |
| 21 // On Windows, we honor the WinINet/IE settings and group policy related to | 21 // On Windows, we honor the WinINet/IE settings and group policy related to |
| 22 // URL Security Zones. See the Microsoft Knowledge Base article 182569 | 22 // URL Security Zones. See the Microsoft Knowledge Base article 182569 |
| 23 // "Internet Explorer security zones registry entries for advanced users" | 23 // "Internet Explorer security zones registry entries for advanced users" |
| 24 // (http://support.microsoft.com/kb/182569) for more info on these registry | 24 // (http://support.microsoft.com/kb/182569) for more info on these registry |
| 25 // keys. | 25 // keys. |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 class URLSecurityManagerWin : public URLSecurityManager { | 29 class URLSecurityManagerWin : public URLSecurityManager { |
| 30 public: | 30 public: |
| 31 explicit URLSecurityManagerWin(const HttpAuthFilter* whitelist_delegate); | 31 explicit URLSecurityManagerWin(const HttpAuthFilter* whitelist_delegate); |
| 32 | 32 |
| 33 // URLSecurityManager methods: | 33 // URLSecurityManager methods: |
| 34 virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const; | 34 virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const; |
| 35 virtual bool CanDelegate(const GURL& auth_origin) const; | 35 virtual bool CanDelegate(const GURL& auth_origin) const; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 bool EnsureSystemSecurityManager(); | 38 bool EnsureSystemSecurityManager(); |
| 39 | 39 |
| 40 ScopedComPtr<IInternetSecurityManager> security_manager_; | 40 base::win::ScopedComPtr<IInternetSecurityManager> security_manager_; |
| 41 scoped_ptr<const HttpAuthFilter> whitelist_delegate_; | 41 scoped_ptr<const HttpAuthFilter> whitelist_delegate_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(URLSecurityManagerWin); | 43 DISALLOW_COPY_AND_ASSIGN(URLSecurityManagerWin); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 URLSecurityManagerWin::URLSecurityManagerWin( | 46 URLSecurityManagerWin::URLSecurityManagerWin( |
| 47 const HttpAuthFilter* whitelist_delegate) | 47 const HttpAuthFilter* whitelist_delegate) |
| 48 : whitelist_delegate_(whitelist_delegate) { | 48 : whitelist_delegate_(whitelist_delegate) { |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |