OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_UI_COCOA_CERTIFICATE_VIEWER_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CERTIFICATE_VIEWER_MAC_H_ |
6 | |
7 #define CHROME_BROWSER_UI_COCOA_CERTIFICATE_VIEWER_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CERTIFICATE_VIEWER_MAC_H_ |
8 | 7 |
9 #include <memory> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import <SecurityInterface/SFCertificatePanel.h> |
10 | 10 |
11 #include "base/mac/scoped_nsobject.h" | 11 namespace content { |
12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 12 class WebContents; |
13 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" | 13 } |
14 | |
15 class SSLCertificateViewerCocoaBridge; | |
16 @class SFCertificatePanel; | |
17 | 14 |
18 namespace net { | 15 namespace net { |
19 class X509Certificate; | 16 class X509Certificate; |
20 } | 17 } |
21 | 18 |
22 @interface SSLCertificateViewerCocoa : NSObject<ConstrainedWindowSheet> { | 19 @interface SFCertificatePanel (SystemPrivate) |
23 @private | 20 // A system-private interface that dismisses a panel whose sheet was started by |
24 // The corresponding list of certificates. | 21 // -beginSheetForWindow: |
25 base::scoped_nsobject<NSArray> certificates_; | 22 // modalDelegate: |
26 std::unique_ptr<SSLCertificateViewerCocoaBridge> observer_; | 23 // didEndSelector: |
27 base::scoped_nsobject<SFCertificatePanel> panel_; | 24 // contextInfo: |
28 std::unique_ptr<ConstrainedWindowMac> constrainedWindow_; | 25 // certificates: |
29 base::scoped_nsobject<NSWindow> overlayWindow_; | 26 // showGroup: |
30 BOOL closePending_; | 27 // as though the user clicked the button identified by returnCode. Verified |
31 // A copy of the overlay window's size used to restore on show. | 28 // present in 10.8. |
32 NSSize oldOverlaySize_; | 29 - (void)_dismissWithCode:(NSInteger)code; |
33 // A copy of the sheet's |autoresizesSubviews| flag to restore on show. | 30 @end |
34 BOOL oldResizesSubviews_; | |
35 } | |
36 | 31 |
| 32 // Base class for the certificate viewer generated by OSX for Chrome Mac. |
| 33 // It grabs the certificates for a given WebContents object and displays the |
| 34 // certificate viewer. |
| 35 @interface SSLCertificateViewerMac : NSObject |
| 36 |
| 37 // Initializes |certificates_| with the certificate chain for a given |
| 38 // certificate. |
37 - (id)initWithCertificate:(net::X509Certificate*)certificate; | 39 - (id)initWithCertificate:(net::X509Certificate*)certificate; |
38 | 40 |
| 41 // Closes the certificate viewer Cocoa sheet. Subclasses must implement this. |
| 42 - (void)sheetDidEnd:(NSWindow*)parent |
| 43 returnCode:(NSInteger)returnCode |
| 44 context:(void*)context; |
| 45 |
| 46 // Initializes the SFCertificatePanel provided by the OS to show the |
| 47 // certificate. Also handles showing revoked certificates. |
39 - (void)displayForWebContents:(content::WebContents*)webContents; | 48 - (void)displayForWebContents:(content::WebContents*)webContents; |
40 | 49 |
41 - (NSWindow*)overlayWindow; | 50 // Shows the certificate viewer as a Cocoa sheet. |
| 51 - (void)showCertificateSheet:(NSWindow*)window; |
| 52 |
| 53 // Closes the certificate viewer sheet. |
| 54 - (void)closeCertificateSheet; |
| 55 |
| 56 // Releases the native SFCertificatePanel window sheet. |
| 57 - (void)releaseSheetWindow; |
| 58 |
| 59 // Returns the certificate panel used as the certificate viewer sheet. |
| 60 - (NSWindow*)certificatePanel; |
42 | 61 |
43 @end | 62 @end |
44 | 63 |
45 #endif // CHROME_BROWSER_UI_COCOA_CERTIFICATE_VIEWER_MAC_H_ | 64 #endif // CHROME_BROWSER_UI_COCOA_CERTIFICATE_VIEWER_MAC_H_ |
OLD | NEW |