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

Side by Side Diff: chrome/browser/ui/cocoa/certificate_viewer_mac_cocoa.mm

Issue 2562653002: Mac: Fix window ordering for certificate viewer/selector sheets and overlays.
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 [self closeCertificateSheet]; 92 [self closeCertificateSheet];
93 } 93 }
94 94
95 - (void)hideSheet { 95 - (void)hideSheet {
96 NSWindow* sheetWindow = [overlayWindow_ attachedSheet]; 96 NSWindow* sheetWindow = [overlayWindow_ attachedSheet];
97 [sheetWindow setAlphaValue:0.0]; 97 [sheetWindow setAlphaValue:0.0];
98 [sheetWindow setIgnoresMouseEvents:YES]; 98 [sheetWindow setIgnoresMouseEvents:YES];
99 99
100 oldResizesSubviews_ = [[sheetWindow contentView] autoresizesSubviews]; 100 oldResizesSubviews_ = [[sheetWindow contentView] autoresizesSubviews];
101 [[sheetWindow contentView] setAutoresizesSubviews:NO]; 101 [[sheetWindow contentView] setAutoresizesSubviews:NO];
102
103 // Ensure this overlay doesn't interfere with overlays with hidden sheets.
104 [overlayWindow_ setLevel:0];
102 } 105 }
103 106
104 - (void)unhideSheet { 107 - (void)unhideSheet {
105 NSWindow* sheetWindow = [overlayWindow_ attachedSheet]; 108 NSWindow* sheetWindow = [overlayWindow_ attachedSheet];
106 [sheetWindow setIgnoresMouseEvents:NO]; 109 [sheetWindow setIgnoresMouseEvents:NO];
107 110
108 [[sheetWindow contentView] setAutoresizesSubviews:oldResizesSubviews_]; 111 [[sheetWindow contentView] setAutoresizesSubviews:oldResizesSubviews_];
109 [[overlayWindow_ attachedSheet] setAlphaValue:1.0]; 112 [[overlayWindow_ attachedSheet] setAlphaValue:1.0];
113
114 // Set the current overlay's level higher than overlays with hidden sheets.
115 [overlayWindow_ setLevel:1];
110 } 116 }
111 117
112 - (void)pulseSheet { 118 - (void)pulseSheet {
113 // NOOP 119 // NOOP
114 } 120 }
115 121
116 - (void)makeSheetKeyAndOrderFront { 122 - (void)makeSheetKeyAndOrderFront {
117 [[overlayWindow_ attachedSheet] makeKeyAndOrderFront:nil]; 123 [[overlayWindow_ attachedSheet] makeKeyAndOrderFront:nil];
118 } 124 }
119 125
(...skipping 13 matching lines...) Expand all
133 139
134 void ShowCertificateViewer(content::WebContents* web_contents, 140 void ShowCertificateViewer(content::WebContents* web_contents,
135 gfx::NativeWindow parent, 141 gfx::NativeWindow parent,
136 net::X509Certificate* cert) { 142 net::X509Certificate* cert) {
137 // SSLCertificateViewerCocoa will manage its own lifetime and will release 143 // SSLCertificateViewerCocoa will manage its own lifetime and will release
138 // itself when the dialog is closed. 144 // itself when the dialog is closed.
139 // See -[SSLCertificateViewerCocoa onConstrainedWindowClosed]. 145 // See -[SSLCertificateViewerCocoa onConstrainedWindowClosed].
140 [[SSLCertificateViewerCocoa alloc] initWithCertificate:cert 146 [[SSLCertificateViewerCocoa alloc] initWithCertificate:cert
141 forWebContents:web_contents]; 147 forWebContents:web_contents];
142 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698