| 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 #import "chrome/browser/ui/cocoa/certificate_viewer_mac.h" | 5 #import "chrome/browser/ui/cocoa/certificate_viewer_mac.h" |
| 6 | 6 |
| 7 #include <Security/Security.h> | 7 #include <Security/Security.h> |
| 8 #include <SecurityInterface/SFCertificatePanel.h> | 8 #include <SecurityInterface/SFCertificatePanel.h> |
| 9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 void MaybeConstrainPanelSizeForSierraBug() { | 62 void MaybeConstrainPanelSizeForSierraBug() { |
| 63 #if defined(MAC_OS_X_VERSION_10_11) && \ | 63 #if defined(MAC_OS_X_VERSION_10_11) && \ |
| 64 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 | 64 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 |
| 65 // This is known not to be required when linking against the 10.11 SDK. Early | 65 // This is known not to be required when linking against the 10.11 SDK. Early |
| 66 // exit in that case but assume anything earlier is broken. | 66 // exit in that case but assume anything earlier is broken. |
| 67 return; | 67 return; |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 // It's also not required when running on El Capitan or earlier. | 70 // It's also not required when running on El Capitan or earlier. |
| 71 if (base::mac::IsAtMostOS10_11() || g_real_certificate_panel_setframe) | 71 if (base::mac::IsOSElCapitanOrEarlier() || g_real_certificate_panel_setframe) |
| 72 return; | 72 return; |
| 73 | 73 |
| 74 const SEL kSetFrame = @selector(setFrame:display:animate:); | 74 const SEL kSetFrame = @selector(setFrame:display:animate:); |
| 75 Method real_method = | 75 Method real_method = |
| 76 class_getInstanceMethod([SFCertificatePanel class], kSetFrame); | 76 class_getInstanceMethod([SFCertificatePanel class], kSetFrame); |
| 77 const char* type_encoding = method_getTypeEncoding(real_method); | 77 const char* type_encoding = method_getTypeEncoding(real_method); |
| 78 g_real_certificate_panel_setframe = method_getImplementation(real_method); | 78 g_real_certificate_panel_setframe = method_getImplementation(real_method); |
| 79 DCHECK(g_real_certificate_panel_setframe); | 79 DCHECK(g_real_certificate_panel_setframe); |
| 80 IMP method = reinterpret_cast<IMP>(&SFCertificatePanelSetFrameOverride); | 80 IMP method = reinterpret_cast<IMP>(&SFCertificatePanelSetFrameOverride); |
| 81 BOOL method_added = class_addMethod([SFCertificatePanel class], kSetFrame, | 81 BOOL method_added = class_addMethod([SFCertificatePanel class], kSetFrame, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 return panel_; | 266 return panel_; |
| 267 } | 267 } |
| 268 | 268 |
| 269 - (void)onConstrainedWindowClosed { | 269 - (void)onConstrainedWindowClosed { |
| 270 panel_.reset(); | 270 panel_.reset(); |
| 271 constrainedWindow_.reset(); | 271 constrainedWindow_.reset(); |
| 272 [self release]; | 272 [self release]; |
| 273 } | 273 } |
| 274 | 274 |
| 275 @end | 275 @end |
| OLD | NEW |