OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/certificate_viewer_mac_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/certificate_viewer_mac_cocoa.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
9 #include "chrome/browser/certificate_viewer.h" | 9 #include "chrome/browser/certificate_viewer.h" |
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 std::unique_ptr<SSLCertificateViewerCocoaBridge> observer_; | 45 std::unique_ptr<SSLCertificateViewerCocoaBridge> observer_; |
46 std::unique_ptr<ConstrainedWindowMac> constrainedWindow_; | 46 std::unique_ptr<ConstrainedWindowMac> constrainedWindow_; |
47 base::scoped_nsobject<NSWindow> overlayWindow_; | 47 base::scoped_nsobject<NSWindow> overlayWindow_; |
48 // A copy of the sheet's frame. Used to restore on show. | 48 // A copy of the sheet's frame. Used to restore on show. |
49 NSRect oldSheetFrame_; | 49 NSRect oldSheetFrame_; |
50 BOOL closePending_; | 50 BOOL closePending_; |
51 // A copy of the sheet's |autoresizesSubviews| flag to restore on show. | 51 // A copy of the sheet's |autoresizesSubviews| flag to restore on show. |
52 BOOL oldResizesSubviews_; | 52 BOOL oldResizesSubviews_; |
53 } | 53 } |
54 | 54 |
55 - (NSWindow*)overlayWindow { | |
56 return overlayWindow_; | |
57 } | |
58 | |
59 - (void)displayForWebContents:(content::WebContents*)webContents { | 55 - (void)displayForWebContents:(content::WebContents*)webContents { |
60 [super displayForWebContents:webContents]; | 56 [super displayForWebContents:webContents]; |
61 | 57 |
62 observer_.reset(new SSLCertificateViewerCocoaBridge(self)); | 58 observer_.reset(new SSLCertificateViewerCocoaBridge(self)); |
63 constrainedWindow_ = | 59 constrainedWindow_ = |
64 CreateAndShowWebModalDialogMac(observer_.get(), webContents, self); | 60 CreateAndShowWebModalDialogMac(observer_.get(), webContents, self); |
65 } | 61 } |
66 | 62 |
67 - (void)onConstrainedWindowClosed { | 63 - (void)onConstrainedWindowClosed { |
68 constrainedWindow_.reset(); | 64 constrainedWindow_.reset(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void ShowCertificateViewer(content::WebContents* web_contents, | 129 void ShowCertificateViewer(content::WebContents* web_contents, |
134 gfx::NativeWindow parent, | 130 gfx::NativeWindow parent, |
135 net::X509Certificate* cert) { | 131 net::X509Certificate* cert) { |
136 // SSLCertificateViewerCocoa will manage its own lifetime and will release | 132 // SSLCertificateViewerCocoa will manage its own lifetime and will release |
137 // itself when the dialog is closed. | 133 // itself when the dialog is closed. |
138 // See -[SSLCertificateViewerCocoa onConstrainedWindowClosed]. | 134 // See -[SSLCertificateViewerCocoa onConstrainedWindowClosed]. |
139 SSLCertificateViewerCocoa* viewer = | 135 SSLCertificateViewerCocoa* viewer = |
140 [[SSLCertificateViewerCocoa alloc] initWithCertificate:cert]; | 136 [[SSLCertificateViewerCocoa alloc] initWithCertificate:cert]; |
141 [viewer displayForWebContents:web_contents]; | 137 [viewer displayForWebContents:web_contents]; |
142 } | 138 } |
OLD | NEW |