| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/ssl_client_certificate_selector.h" | 5 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
| 6 | 6 |
| 7 #import <SecurityInterface/SFChooseIdentityPanel.h> | 7 #import <SecurityInterface/SFChooseIdentityPanel.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #import "base/memory/scoped_nsobject.h" | 13 #import "base/memory/scoped_nsobject.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 SSLClientCertificateSelectorCocoa* controller_; | 129 SSLClientCertificateSelectorCocoa* controller_; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 namespace chrome { | 134 namespace chrome { |
| 135 | 135 |
| 136 void ShowSSLClientCertificateSelector( | 136 void ShowSSLClientCertificateSelector( |
| 137 TabContents* tabContents, | 137 content::WebContents* contents, |
| 138 const net::HttpNetworkSession* network_session, | 138 const net::HttpNetworkSession* network_session, |
| 139 net::SSLCertRequestInfo* cert_request_info, | 139 net::SSLCertRequestInfo* cert_request_info, |
| 140 const base::Callback<void(net::X509Certificate*)>& callback) { | 140 const base::Callback<void(net::X509Certificate*)>& callback) { |
| 141 TabContents* tab_contents = TabContents::FromWebContents(contents); |
| 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 142 SSLClientCertificateSelectorCocoa* selector = | 143 SSLClientCertificateSelectorCocoa* selector = |
| 143 [[[SSLClientCertificateSelectorCocoa alloc] | 144 [[[SSLClientCertificateSelectorCocoa alloc] |
| 144 initWithObserver:network_session | 145 initWithObserver:network_session |
| 145 certRequestInfo:cert_request_info | 146 certRequestInfo:cert_request_info |
| 146 callback:callback] autorelease]; | 147 callback:callback] autorelease]; |
| 147 [selector displayDialog:tabContents]; | 148 [selector displayDialog:tab_contents]; |
| 148 } | 149 } |
| 149 | 150 |
| 150 } // namespace chrome | 151 } // namespace chrome |
| 151 | 152 |
| 152 @implementation SSLClientCertificateSelectorCocoa | 153 @implementation SSLClientCertificateSelectorCocoa |
| 153 | 154 |
| 154 - (id)initWithObserver:(const net::HttpNetworkSession*)networkSession | 155 - (id)initWithObserver:(const net::HttpNetworkSession*)networkSession |
| 155 certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo | 156 certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo |
| 156 callback:(const base::Callback<void(net::X509Certificate*)>&)callback { | 157 callback:(const base::Callback<void(net::X509Certificate*)>&)callback { |
| 157 DCHECK(networkSession); | 158 DCHECK(networkSession); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 panel, self, | 231 panel, self, |
| 231 @selector(sheetDidEnd:returnCode:context:), | 232 @selector(sheetDidEnd:returnCode:context:), |
| 232 identities_, title)); | 233 identities_, title)); |
| 233 observer_->StartObserving(); | 234 observer_->StartObserving(); |
| 234 // Note: SFChooseIdentityPanel does not take a reference to itself while the | 235 // Note: SFChooseIdentityPanel does not take a reference to itself while the |
| 235 // sheet is open. ConstrainedSFChooseIdentityPanel will release ownership | 236 // sheet is open. ConstrainedSFChooseIdentityPanel will release ownership |
| 236 // on destruction. | 237 // on destruction. |
| 237 } | 238 } |
| 238 | 239 |
| 239 @end | 240 @end |
| OLD | NEW |