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

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

Issue 1234073002: Allow cert-popup for WebView guests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comments. Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/certificate_selector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ssl_client_certificate_selector_cocoa.h" 5 #import "chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h"
6 6
7 #import <SecurityInterface/SFChooseIdentityPanel.h> 7 #import <SecurityInterface/SFChooseIdentityPanel.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/ssl/ssl_client_auth_observer.h" 14 #include "chrome/browser/ssl/ssl_client_auth_observer.h"
15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "components/guest_view/browser/guest_view_base.h"
17 #include "components/web_modal/popup_manager.h" 18 #include "components/web_modal/popup_manager.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/client_certificate_delegate.h" 20 #include "content/public/browser/client_certificate_delegate.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "net/cert/x509_certificate.h" 22 #include "net/cert/x509_certificate.h"
22 #include "net/cert/x509_util_mac.h" 23 #include "net/cert/x509_util_mac.h"
23 #include "net/ssl/ssl_cert_request_info.h" 24 #include "net/ssl/ssl_cert_request_info.h"
24 #include "ui/base/cocoa/window_size_constants.h" 25 #include "ui/base/cocoa/window_size_constants.h"
25 #include "ui/base/l10n/l10n_util_mac.h" 26 #include "ui/base/l10n/l10n_util_mac.h"
26 27
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 namespace chrome { 74 namespace chrome {
74 75
75 void ShowSSLClientCertificateSelector( 76 void ShowSSLClientCertificateSelector(
76 content::WebContents* contents, 77 content::WebContents* contents,
77 net::SSLCertRequestInfo* cert_request_info, 78 net::SSLCertRequestInfo* cert_request_info,
78 scoped_ptr<content::ClientCertificateDelegate> delegate) { 79 scoped_ptr<content::ClientCertificateDelegate> delegate) {
79 DCHECK_CURRENTLY_ON(BrowserThread::UI); 80 DCHECK_CURRENTLY_ON(BrowserThread::UI);
80 81
81 // Not all WebContentses can show modal dialogs. 82 // Not all WebContentses can show modal dialogs.
82 // 83 //
84 // Use the top-level embedder if |contents| is a guest.
85 // GetTopLevelWebContents() will return |contents| otherwise.
83 // TODO(davidben): Move this hook to the WebContentsDelegate and only try to 86 // TODO(davidben): Move this hook to the WebContentsDelegate and only try to
84 // show a dialog in Browser's implementation. https://crbug.com/456255 87 // show a dialog in Browser's implementation. https://crbug.com/456255
85 if (web_modal::PopupManager::FromWebContents(contents) == nullptr) 88 if (web_modal::PopupManager::FromWebContents(
89 guest_view::GuestViewBase::GetTopLevelWebContents(contents)) ==
90 nullptr)
86 return; 91 return;
87 92
88 // The dialog manages its own lifetime. 93 // The dialog manages its own lifetime.
89 SSLClientCertificateSelectorCocoa* selector = 94 SSLClientCertificateSelectorCocoa* selector =
90 [[SSLClientCertificateSelectorCocoa alloc] 95 [[SSLClientCertificateSelectorCocoa alloc]
91 initWithBrowserContext:contents->GetBrowserContext() 96 initWithBrowserContext:contents->GetBrowserContext()
92 certRequestInfo:cert_request_info 97 certRequestInfo:cert_request_info
93 delegate:delegate.Pass()]; 98 delegate:delegate.Pass()];
94 [selector displayForWebContents:contents]; 99 [selector displayForWebContents:contents];
95 } 100 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 261 }
257 262
258 - (void)onConstrainedWindowClosed { 263 - (void)onConstrainedWindowClosed {
259 observer_->StopObserving(); 264 observer_->StopObserving();
260 panel_.reset(); 265 panel_.reset();
261 constrainedWindow_.reset(); 266 constrainedWindow_.reset();
262 [self release]; 267 [self release];
263 } 268 }
264 269
265 @end 270 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/certificate_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698