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

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

Issue 12041059: content: convert SSL notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ssl/ssl_tab_helper.h ('k') | chrome/browser/ui/browser.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 #include "chrome/browser/ssl/ssl_tab_helper.h" 5 #include "chrome/browser/ssl/ssl_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 15 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
16 #include "chrome/browser/api/infobars/infobar_service.h" 16 #include "chrome/browser/api/infobars/infobar_service.h"
17 #include "chrome/browser/certificate_viewer.h" 17 #include "chrome/browser/certificate_viewer.h"
18 #include "chrome/browser/content_settings/host_content_settings_map.h" 18 #include "chrome/browser/content_settings/host_content_settings_map.h"
19 #include "chrome/browser/infobars/infobar.h" 19 #include "chrome/browser/infobars/infobar.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ssl/ssl_add_cert_handler.h" 21 #include "chrome/browser/ssl/ssl_add_cert_handler.h"
22 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" 22 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
23 #include "chrome/browser/ui/browser_finder.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "content/public/browser/notification_details.h" 26 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
28 #include "content/public/browser/notification_source.h" 29 #include "content/public/browser/notification_source.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_view.h" 31 #include "content/public/browser/web_contents_view.h"
31 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
32 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 content::Details<InfoBarReplacedDetails>(details)->first)) 185 content::Details<InfoBarReplacedDetails>(details)->first))
185 infobar_delegate_ = NULL; 186 infobar_delegate_ = NULL;
186 } 187 }
187 188
188 189
189 // SSLTabHelper ---------------------------------------------------------------- 190 // SSLTabHelper ----------------------------------------------------------------
190 191
191 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SSLTabHelper); 192 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SSLTabHelper);
192 193
193 SSLTabHelper::SSLTabHelper(content::WebContents* contents) 194 SSLTabHelper::SSLTabHelper(content::WebContents* contents)
194 : web_contents_(contents) { 195 : WebContentsObserver(contents),
196 web_contents_(contents) {
195 } 197 }
196 198
197 SSLTabHelper::~SSLTabHelper() { 199 SSLTabHelper::~SSLTabHelper() {
198 } 200 }
199 201
202 void SSLTabHelper::DidChangeVisibleSSLState() {
203 #if !defined(OS_ANDROID)
204 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
205 if (browser)
206 browser->VisibleSSLStateChanged(web_contents_);
207 #endif // !defined(OS_ANDROID)
208 }
209
200 void SSLTabHelper::ShowClientCertificateRequestDialog( 210 void SSLTabHelper::ShowClientCertificateRequestDialog(
201 const net::HttpNetworkSession* network_session, 211 const net::HttpNetworkSession* network_session,
202 net::SSLCertRequestInfo* cert_request_info, 212 net::SSLCertRequestInfo* cert_request_info,
203 const base::Callback<void(net::X509Certificate*)>& callback) { 213 const base::Callback<void(net::X509Certificate*)>& callback) {
204 chrome::ShowSSLClientCertificateSelector( 214 chrome::ShowSSLClientCertificateSelector(
205 web_contents_, network_session, cert_request_info, callback); 215 web_contents_, network_session, cert_request_info, callback);
206 } 216 }
207 217
208 void SSLTabHelper::OnVerifyClientCertificateError( 218 void SSLTabHelper::OnVerifyClientCertificateError(
209 scoped_refptr<SSLAddCertHandler> handler, int error_code) { 219 scoped_refptr<SSLAddCertHandler> handler, int error_code) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 SSLTabHelper::SSLAddCertData* 265 SSLTabHelper::SSLAddCertData*
256 SSLTabHelper::GetAddCertData(SSLAddCertHandler* handler) { 266 SSLTabHelper::GetAddCertData(SSLAddCertHandler* handler) {
257 // Find/create the slot. 267 // Find/create the slot.
258 linked_ptr<SSLAddCertData>& ptr_ref = 268 linked_ptr<SSLAddCertData>& ptr_ref =
259 request_id_to_add_cert_data_[handler->network_request_id()]; 269 request_id_to_add_cert_data_[handler->network_request_id()];
260 // Fill it if necessary. 270 // Fill it if necessary.
261 if (!ptr_ref.get()) 271 if (!ptr_ref.get())
262 ptr_ref.reset(new SSLAddCertData(web_contents_)); 272 ptr_ref.reset(new SSLAddCertData(web_contents_));
263 return ptr_ref.get(); 273 return ptr_ref.get();
264 } 274 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_tab_helper.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698