Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Side by Side Diff: chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm

Issue 755933002: Revert of "Remove SSLClientAuthHandler's RDH dependency." (https://codereview.chromium.org/59687300… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one other VLOG -> DVLOG conversion Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h" 5 #import "chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h"
6 6
7 #import <SecurityInterface/SFChooseIdentityPanel.h> 7 #import <SecurityInterface/SFChooseIdentityPanel.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 22 matching lines...) Expand all
33 @end 33 @end
34 34
35 @interface SSLClientCertificateSelectorCocoa () 35 @interface SSLClientCertificateSelectorCocoa ()
36 - (void)onConstrainedWindowClosed; 36 - (void)onConstrainedWindowClosed;
37 @end 37 @end
38 38
39 class SSLClientAuthObserverCocoaBridge : public SSLClientAuthObserver, 39 class SSLClientAuthObserverCocoaBridge : public SSLClientAuthObserver,
40 public ConstrainedWindowMacDelegate { 40 public ConstrainedWindowMacDelegate {
41 public: 41 public:
42 SSLClientAuthObserverCocoaBridge( 42 SSLClientAuthObserverCocoaBridge(
43 const content::BrowserContext* browser_context, 43 const net::HttpNetworkSession* network_session,
44 net::SSLCertRequestInfo* cert_request_info, 44 net::SSLCertRequestInfo* cert_request_info,
45 const chrome::SelectCertificateCallback& callback, 45 const chrome::SelectCertificateCallback& callback,
46 SSLClientCertificateSelectorCocoa* controller) 46 SSLClientCertificateSelectorCocoa* controller)
47 : SSLClientAuthObserver(browser_context, cert_request_info, callback), 47 : SSLClientAuthObserver(network_session, cert_request_info, callback),
48 controller_(controller) { 48 controller_(controller) {
49 } 49 }
50 50
51 // SSLClientAuthObserver implementation: 51 // SSLClientAuthObserver implementation:
52 void OnCertSelectedByNotification() override { 52 void OnCertSelectedByNotification() override {
53 [controller_ closeWebContentsModalDialog]; 53 [controller_ closeWebContentsModalDialog];
54 } 54 }
55 55
56 // ConstrainedWindowMacDelegate implementation: 56 // ConstrainedWindowMacDelegate implementation:
57 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override { 57 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override {
58 // |onConstrainedWindowClosed| will delete the sheet which might be still 58 // |onConstrainedWindowClosed| will delete the sheet which might be still
59 // in use higher up the call stack. Wait for the next cycle of the event 59 // in use higher up the call stack. Wait for the next cycle of the event
60 // loop to call this function. 60 // loop to call this function.
61 [controller_ performSelector:@selector(onConstrainedWindowClosed) 61 [controller_ performSelector:@selector(onConstrainedWindowClosed)
62 withObject:nil 62 withObject:nil
63 afterDelay:0]; 63 afterDelay:0];
64 } 64 }
65 65
66 private: 66 private:
67 SSLClientCertificateSelectorCocoa* controller_; // weak 67 SSLClientCertificateSelectorCocoa* controller_; // weak
68 }; 68 };
69 69
70 namespace chrome { 70 namespace chrome {
71 71
72 void ShowSSLClientCertificateSelector( 72 void ShowSSLClientCertificateSelector(
73 content::WebContents* contents, 73 content::WebContents* contents,
74 const net::HttpNetworkSession* network_session,
74 net::SSLCertRequestInfo* cert_request_info, 75 net::SSLCertRequestInfo* cert_request_info,
75 const SelectCertificateCallback& callback) { 76 const SelectCertificateCallback& callback) {
76 DCHECK_CURRENTLY_ON(BrowserThread::UI); 77 DCHECK_CURRENTLY_ON(BrowserThread::UI);
77 // The dialog manages its own lifetime. 78 // The dialog manages its own lifetime.
78 SSLClientCertificateSelectorCocoa* selector = 79 SSLClientCertificateSelectorCocoa* selector =
79 [[SSLClientCertificateSelectorCocoa alloc] 80 [[SSLClientCertificateSelectorCocoa alloc]
80 initWithBrowserContext:contents->GetBrowserContext() 81 initWithNetworkSession:network_session
81 certRequestInfo:cert_request_info 82 certRequestInfo:cert_request_info
82 callback:callback]; 83 callback:callback];
83 [selector displayForWebContents:contents]; 84 [selector displayForWebContents:contents];
84 } 85 }
85 86
86 } // namespace chrome 87 } // namespace chrome
87 88
88 @implementation SSLClientCertificateSelectorCocoa 89 @implementation SSLClientCertificateSelectorCocoa
89 90
90 - (id)initWithBrowserContext:(const content::BrowserContext*)browserContext 91 - (id)initWithNetworkSession:(const net::HttpNetworkSession*)networkSession
91 certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo 92 certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo
92 callback:(const chrome::SelectCertificateCallback&)callback { 93 callback:(const chrome::SelectCertificateCallback&)callback {
93 DCHECK(browserContext); 94 DCHECK(networkSession);
94 DCHECK(certRequestInfo); 95 DCHECK(certRequestInfo);
95 if ((self = [super init])) { 96 if ((self = [super init])) {
96 observer_.reset(new SSLClientAuthObserverCocoaBridge( 97 observer_.reset(new SSLClientAuthObserverCocoaBridge(
97 browserContext, certRequestInfo, callback, self)); 98 networkSession, certRequestInfo, callback, self));
98 } 99 }
99 return self; 100 return self;
100 } 101 }
101 102
102 - (void)sheetDidEnd:(NSWindow*)parent 103 - (void)sheetDidEnd:(NSWindow*)parent
103 returnCode:(NSInteger)returnCode 104 returnCode:(NSInteger)returnCode
104 context:(void*)context { 105 context:(void*)context {
105 net::X509Certificate* cert = NULL; 106 net::X509Certificate* cert = NULL;
106 if (returnCode == NSFileHandlingPanelOKButton) { 107 if (returnCode == NSFileHandlingPanelOKButton) {
107 CFRange range = CFRangeMake(0, CFArrayGetCount(identities_)); 108 CFRange range = CFRangeMake(0, CFArrayGetCount(identities_));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 229 }
229 230
230 - (void)onConstrainedWindowClosed { 231 - (void)onConstrainedWindowClosed {
231 observer_->StopObserving(); 232 observer_->StopObserving();
232 panel_.reset(); 233 panel_.reset();
233 constrainedWindow_.reset(); 234 constrainedWindow_.reset();
234 [self release]; 235 [self release];
235 } 236 }
236 237
237 @end 238 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698