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

Side by Side Diff: content/browser/ssl/ssl_manager.cc

Issue 7542029: Profiles: SSLManger broadcasts SSL_INTERNAL_STATE_CHANGED with a NavigationController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move from NavigationController to BrowserContext as the source. Created 9 years, 4 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 | « content/browser/ssl/ssl_manager.h ('k') | content/browser/ssl/ssl_policy_backend.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/ssl/ssl_manager.h" 5 #include "content/browser/ssl/ssl_manager.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/browser_thread.h" 8 #include "content/browser/browser_thread.h"
9 #include "content/browser/load_from_memory_cache_details.h" 9 #include "content/browser/load_from_memory_cache_details.h"
10 #include "content/browser/renderer_host/resource_dispatcher_host.h" 10 #include "content/browser/renderer_host/resource_dispatcher_host.h"
11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
12 #include "content/browser/renderer_host/resource_request_details.h" 12 #include "content/browser/renderer_host/resource_request_details.h"
13 #include "content/browser/ssl/ssl_cert_error_handler.h" 13 #include "content/browser/ssl/ssl_cert_error_handler.h"
14 #include "content/browser/ssl/ssl_policy.h" 14 #include "content/browser/ssl/ssl_policy.h"
15 #include "content/browser/ssl/ssl_request_info.h" 15 #include "content/browser/ssl/ssl_request_info.h"
16 #include "content/browser/tab_contents/navigation_details.h" 16 #include "content/browser/tab_contents/navigation_details.h"
17 #include "content/browser/tab_contents/navigation_entry.h" 17 #include "content/browser/tab_contents/navigation_entry.h"
18 #include "content/browser/tab_contents/provisional_load_details.h" 18 #include "content/browser/tab_contents/provisional_load_details.h"
19 #include "content/browser/tab_contents/tab_contents.h" 19 #include "content/browser/tab_contents/tab_contents.h"
20 #include "content/common/notification_service.h" 20 #include "content/common/notification_service.h"
21 #include "content/common/notification_source.h"
21 #include "net/base/cert_status_flags.h" 22 #include "net/base/cert_status_flags.h"
22 23
23 // static 24 // static
24 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, 25 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh,
25 net::URLRequest* request, 26 net::URLRequest* request,
26 int cert_error, 27 int cert_error,
27 net::X509Certificate* cert) { 28 net::X509Certificate* cert) {
28 DVLOG(1) << "OnSSLCertificateError() cert_error: " << cert_error 29 DVLOG(1) << "OnSSLCertificateError() cert_error: " << cert_error
29 << " url: " << request->url().spec(); 30 << " url: " << request->url().spec();
30 31
31 ResourceDispatcherHostRequestInfo* info = 32 ResourceDispatcherHostRequestInfo* info =
32 ResourceDispatcherHost::InfoForRequest(request); 33 ResourceDispatcherHost::InfoForRequest(request);
33 34
34 // A certificate error occurred. Construct a SSLCertErrorHandler object and 35 // A certificate error occurred. Construct a SSLCertErrorHandler object and
35 // hand it over to the UI thread for processing. 36 // hand it over to the UI thread for processing.
36 BrowserThread::PostTask( 37 BrowserThread::PostTask(
37 BrowserThread::UI, FROM_HERE, 38 BrowserThread::UI, FROM_HERE,
38 NewRunnableMethod(new SSLCertErrorHandler(rdh, 39 NewRunnableMethod(new SSLCertErrorHandler(rdh,
39 request, 40 request,
40 info->resource_type(), 41 info->resource_type(),
41 cert_error, 42 cert_error,
42 cert), 43 cert),
43 &SSLCertErrorHandler::Dispatch)); 44 &SSLCertErrorHandler::Dispatch));
44 } 45 }
45 46
46 // static 47 // static
47 void SSLManager::NotifySSLInternalStateChanged() { 48 void SSLManager::NotifySSLInternalStateChanged(
49 NavigationController* controller) {
48 NotificationService::current()->Notify( 50 NotificationService::current()->Notify(
49 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, 51 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
50 NotificationService::AllSources(), 52 Source<content::BrowserContext>(controller->browser_context()),
51 NotificationService::NoDetails()); 53 Details<NavigationController>(controller));
abarth-chromium 2011/08/04 21:09:32 These details shouldn't be needed. I'd skip it.
52 } 54 }
53 55
54 // static 56 // static
55 std::string SSLManager::SerializeSecurityInfo(int cert_id, 57 std::string SSLManager::SerializeSecurityInfo(int cert_id,
56 int cert_status, 58 int cert_status,
57 int security_bits, 59 int security_bits,
58 int ssl_connection_status) { 60 int ssl_connection_status) {
59 Pickle pickle; 61 Pickle pickle;
60 pickle.WriteInt(cert_id); 62 pickle.WriteInt(cert_id);
61 pickle.WriteInt(cert_status); 63 pickle.WriteInt(cert_status);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Subscribe to various notifications. 100 // Subscribe to various notifications.
99 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, 101 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
100 Source<NavigationController>(controller_)); 102 Source<NavigationController>(controller_));
101 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, 103 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED,
102 Source<RenderViewHostDelegate>(controller_->tab_contents())); 104 Source<RenderViewHostDelegate>(controller_->tab_contents()));
103 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, 105 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
104 Source<RenderViewHostDelegate>(controller_->tab_contents())); 106 Source<RenderViewHostDelegate>(controller_->tab_contents()));
105 registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, 107 registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
106 Source<NavigationController>(controller_)); 108 Source<NavigationController>(controller_));
107 registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, 109 registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
108 NotificationService::AllSources()); 110 Source<content::BrowserContext>(
111 controller_->browser_context()));
109 } 112 }
110 113
111 SSLManager::~SSLManager() { 114 SSLManager::~SSLManager() {
112 } 115 }
113 116
114 void SSLManager::DidCommitProvisionalLoad( 117 void SSLManager::DidCommitProvisionalLoad(
115 const NotificationDetails& in_details) { 118 const NotificationDetails& in_details) {
116 content::LoadCommittedDetails* details = 119 content::LoadCommittedDetails* details =
117 Details<content::LoadCommittedDetails>(in_details).ptr(); 120 Details<content::LoadCommittedDetails>(in_details).ptr();
118 121
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 240
238 policy()->UpdateEntry(entry, controller_->tab_contents()); 241 policy()->UpdateEntry(entry, controller_->tab_contents());
239 242
240 if (!entry->ssl().Equals(original_ssl_status)) { 243 if (!entry->ssl().Equals(original_ssl_status)) {
241 NotificationService::current()->Notify( 244 NotificationService::current()->Notify(
242 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, 245 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED,
243 Source<NavigationController>(controller_), 246 Source<NavigationController>(controller_),
244 NotificationService::NoDetails()); 247 NotificationService::NoDetails());
245 } 248 }
246 } 249 }
OLDNEW
« no previous file with comments | « content/browser/ssl/ssl_manager.h ('k') | content/browser/ssl/ssl_policy_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698