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

Side by Side Diff: chrome/browser/ssl/ssl_client_auth_observer.cc

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
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 #include "chrome/browser/ssl/ssl_client_auth_observer.h" 5 #include "chrome/browser/ssl/ssl_client_auth_observer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 StopObserving(); 60 StopObserving();
61 delegate_.reset(); 61 delegate_.reset();
62 } 62 }
63 63
64 void SSLClientAuthObserver::Observe( 64 void SSLClientAuthObserver::Observe(
65 int type, 65 int type,
66 const content::NotificationSource& source, 66 const content::NotificationSource& source,
67 const content::NotificationDetails& details) { 67 const content::NotificationDetails& details) {
68 DVLOG(1) << "SSLClientAuthObserver::Observe " << this; 68 DVLOG(1) << "SSLClientAuthObserver::Observe " << this;
69 DCHECK_CURRENTLY_ON(BrowserThread::UI); 69 DCHECK_CURRENTLY_ON(BrowserThread::UI);
70 DCHECK(type == chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED); 70 DCHECK_EQ(chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, type);
71 71
72 CertDetails* cert_details = content::Details<CertDetails>(details).ptr(); 72 CertDetails* cert_details = content::Details<CertDetails>(details).ptr();
73 if (!cert_details->first->host_and_port.Equals( 73 if (!cert_details->first->host_and_port.Equals(
74 cert_request_info_->host_and_port)) 74 cert_request_info_->host_and_port))
75 return; 75 return;
76 76
77 DVLOG(1) << this << " got matching notification and selecting cert " 77 DVLOG(1) << this << " got matching notification and selecting cert "
78 << cert_details->second; 78 << cert_details->second;
79 StopObserving(); 79 StopObserving();
80 delegate_->ContinueWithCertificate(cert_details->second); 80 delegate_->ContinueWithCertificate(cert_details->second);
81 delegate_.reset(); 81 delegate_.reset();
82 OnCertSelectedByNotification(); 82 OnCertSelectedByNotification();
83 } 83 }
84 84
85 void SSLClientAuthObserver::StartObserving() { 85 void SSLClientAuthObserver::StartObserving() {
86 DCHECK_CURRENTLY_ON(BrowserThread::UI); 86 DCHECK_CURRENTLY_ON(BrowserThread::UI);
87 notification_registrar_.Add( 87 notification_registrar_.Add(
88 this, chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, 88 this, chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED,
89 content::Source<content::BrowserContext>(browser_context_)); 89 content::Source<content::BrowserContext>(browser_context_));
90 } 90 }
91 91
92 void SSLClientAuthObserver::StopObserving() { 92 void SSLClientAuthObserver::StopObserving() {
93 DCHECK_CURRENTLY_ON(BrowserThread::UI); 93 DCHECK_CURRENTLY_ON(BrowserThread::UI);
94 notification_registrar_.RemoveAll(); 94 notification_registrar_.RemoveAll();
95 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/captive_portal_metrics_recorder.cc ('k') | chrome/browser/ssl/ssl_error_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698