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

Unified Diff: chrome/browser/ui/cocoa/certificate_viewer_mac.mm

Issue 2039823002: MacViews: Refactor certificate viewer tests to work for MacViews browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@certview
Patch Set: Rebase onto master & add ignoreMouseEvents fix for hiding/reshowing the certificate viewer. Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/certificate_viewer_mac.mm
diff --git a/chrome/browser/ui/cocoa/certificate_viewer_mac.mm b/chrome/browser/ui/cocoa/certificate_viewer_mac.mm
index 1a079cac5723e8e6dc1df15863bd4d3c51d4dd17..42ff57d1e5efe9e2a6224d5b428e5774ccf69755 100644
--- a/chrome/browser/ui/cocoa/certificate_viewer_mac.mm
+++ b/chrome/browser/ui/cocoa/certificate_viewer_mac.mm
@@ -165,33 +165,15 @@ void ShowCertificateViewer(content::WebContents* web_contents,
- (void)hideSheet {
NSWindow* sheetWindow = [overlayWindow_ attachedSheet];
[sheetWindow setAlphaValue:0.0];
+ [sheetWindow setIgnoresMouseEvents:YES];
oldResizesSubviews_ = [[sheetWindow contentView] autoresizesSubviews];
[[sheetWindow contentView] setAutoresizesSubviews:NO];
-
- oldSheetFrame_ = [sheetWindow frame];
- NSRect overlayFrame = [overlayWindow_ frame];
- oldSheetFrame_.origin.x -= NSMinX(overlayFrame);
- oldSheetFrame_.origin.y -= NSMinY(overlayFrame);
- oldOverlaySize_ = [overlayWindow_ frame].size;
- [sheetWindow setFrame:ui::kWindowSizeDeterminedLater display:NO];
}
- (void)unhideSheet {
NSWindow* sheetWindow = [overlayWindow_ attachedSheet];
- NSRect overlayFrame = [overlayWindow_ frame];
-
- // If the overlay frame's size has changed, the position offsets need to be
tapted 2016/06/17 06:11:33 So does this happen automatically? (i.e. does the
Patti Lor 2016/06/20 03:42:28 Yep, the certificate viewer position is controlled
- // calculated. Since the certificate is horizontally centered, so the x
- // offset is calculated by halving the width difference. In addition,
- // because the certificate is located directly below the toolbar, the y
- // offset is just the difference in height.
- CGFloat yOffset = (NSHeight(overlayFrame) - oldOverlaySize_.height);
- CGFloat xOffset = (NSWidth(overlayFrame) - oldOverlaySize_.width) / 2;
-
- oldSheetFrame_.origin.x += NSMinX(overlayFrame) + xOffset;
- oldSheetFrame_.origin.y += NSMinY(overlayFrame) + yOffset;
- [sheetWindow setFrame:oldSheetFrame_ display:NO];
+ [sheetWindow setIgnoresMouseEvents:NO];
[[sheetWindow contentView] setAutoresizesSubviews:oldResizesSubviews_];
[[overlayWindow_ attachedSheet] setAlphaValue:1.0];

Powered by Google App Engine
This is Rietveld 408576698