| OLD | NEW |
| 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 "content/browser/ssl/ssl_manager.h" | 5 #include "content/browser/ssl/ssl_manager.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
| 11 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
| 14 #include "content/browser/devtools/devtools_agent_host_impl.h" | 16 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 15 #include "content/browser/devtools/protocol/security_handler.h" | 17 #include "content/browser/devtools/protocol/security_handler.h" |
| 16 #include "content/browser/frame_host/navigation_entry_impl.h" | 18 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 17 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 19 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 18 #include "content/browser/loader/resource_request_info_impl.h" | 20 #include "content/browser/loader/resource_request_info_impl.h" |
| 19 #include "content/browser/ssl/ssl_error_handler.h" | 21 #include "content/browser/ssl/ssl_error_handler.h" |
| 20 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 168 |
| 167 SSLManager::SSLManager(NavigationControllerImpl* controller) | 169 SSLManager::SSLManager(NavigationControllerImpl* controller) |
| 168 : controller_(controller), | 170 : controller_(controller), |
| 169 ssl_host_state_delegate_( | 171 ssl_host_state_delegate_( |
| 170 controller->GetBrowserContext()->GetSSLHostStateDelegate()) { | 172 controller->GetBrowserContext()->GetSSLHostStateDelegate()) { |
| 171 DCHECK(controller_); | 173 DCHECK(controller_); |
| 172 | 174 |
| 173 SSLManagerSet* managers = static_cast<SSLManagerSet*>( | 175 SSLManagerSet* managers = static_cast<SSLManagerSet*>( |
| 174 controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName)); | 176 controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName)); |
| 175 if (!managers) { | 177 if (!managers) { |
| 176 managers = new SSLManagerSet; | 178 auto managers_owned = base::MakeUnique<SSLManagerSet>(); |
| 177 controller_->GetBrowserContext()->SetUserData(kSSLManagerKeyName, managers); | 179 managers = managers_owned.get(); |
| 180 controller_->GetBrowserContext()->SetUserData(kSSLManagerKeyName, |
| 181 std::move(managers_owned)); |
| 178 } | 182 } |
| 179 managers->get().insert(this); | 183 managers->get().insert(this); |
| 180 } | 184 } |
| 181 | 185 |
| 182 SSLManager::~SSLManager() { | 186 SSLManager::~SSLManager() { |
| 183 SSLManagerSet* managers = static_cast<SSLManagerSet*>( | 187 SSLManagerSet* managers = static_cast<SSLManagerSet*>( |
| 184 controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName)); | 188 controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName)); |
| 185 managers->get().erase(this); | 189 managers->get().erase(this); |
| 186 } | 190 } |
| 187 | 191 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 SSLManagerSet* managers = | 454 SSLManagerSet* managers = |
| 451 static_cast<SSLManagerSet*>(context->GetUserData(kSSLManagerKeyName)); | 455 static_cast<SSLManagerSet*>(context->GetUserData(kSSLManagerKeyName)); |
| 452 | 456 |
| 453 for (std::set<SSLManager*>::iterator i = managers->get().begin(); | 457 for (std::set<SSLManager*>::iterator i = managers->get().begin(); |
| 454 i != managers->get().end(); ++i) { | 458 i != managers->get().end(); ++i) { |
| 455 (*i)->UpdateEntry((*i)->controller()->GetLastCommittedEntry(), 0, 0); | 459 (*i)->UpdateEntry((*i)->controller()->GetLastCommittedEntry(), 0, 0); |
| 456 } | 460 } |
| 457 } | 461 } |
| 458 | 462 |
| 459 } // namespace content | 463 } // namespace content |
| OLD | NEW |