Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / ssl_client_certificate_selector_cocoa.h
blobf1fe2e329fc9fabb2a677484ec5d14d4980070fd
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_SSL_CLIENT_CERTIFICATE_SELECTOR_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_SSL_CLIENT_CERTIFICATE_SELECTOR_COCOA_H_
8 #import <Cocoa/Cocoa.h>
9 #include <vector>
11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/mac/scoped_nsobject.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
19 namespace content {
20 class BrowserContext;
21 class ClientCertificateDelegate;
24 class ConstrainedWindowMac;
25 @class SFChooseIdentityPanel;
26 class SSLClientAuthObserverCocoaBridge;
28 @interface SSLClientCertificateSelectorCocoa
29 : NSObject<ConstrainedWindowSheet> {
30 @private
31 // The list of identities offered to the user.
32 base::ScopedCFTypeRef<CFMutableArrayRef> identities_;
33 // The corresponding list of certificates.
34 std::vector<scoped_refptr<net::X509Certificate> > certificates_;
35 // A C++ object to bridge SSLClientAuthObserver notifications to us.
36 scoped_ptr<SSLClientAuthObserverCocoaBridge> observer_;
37 base::scoped_nsobject<SFChooseIdentityPanel> panel_;
38 scoped_ptr<ConstrainedWindowMac> constrainedWindow_;
39 base::scoped_nsobject<NSWindow> overlayWindow_;
40 BOOL closePending_;
41 // A copy of the sheet's frame used to restore on show.
42 NSRect oldSheetFrame_;
43 // A copy of the sheet's |autoresizesSubviews| flag to restore on show.
44 BOOL oldResizesSubviews_;
45 // True if the user dismissed the dialog directly, either via the OK (continue
46 // the request with a certificate) or Cancel (continue the request with no
47 // certificate) buttons.
48 BOOL userResponded_;
51 @property (readonly, nonatomic) SFChooseIdentityPanel* panel;
53 - (id)initWithBrowserContext:(const content::BrowserContext*)browserContext
54 certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo
55 delegate:(scoped_ptr<content::ClientCertificateDelegate>)
56 delegate;
57 - (void)displayForWebContents:(content::WebContents*)webContents;
58 - (void)closeWebContentsModalDialog;
60 - (NSWindow*)overlayWindow;
62 @end
64 #endif // CHROME_BROWSER_UI_COCOA_SSL_CLIENT_CERTIFICATE_SELECTOR_COCOA_H_