| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ios/web/public/browser_state.h" | 5 #include "ios/web/public/browser_state.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ios/web/active_state_manager_impl.h" | 9 #include "ios/web/active_state_manager_impl.h" |
| 10 #import "ios/web/browsing_data_partition_impl.h" | 10 #import "ios/web/browsing_data_partition_impl.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 cert_cache_service_handle); | 45 cert_cache_service_handle); |
| 46 } | 46 } |
| 47 | 47 |
| 48 CertificatePolicyCacheHandle* handle = | 48 CertificatePolicyCacheHandle* handle = |
| 49 static_cast<CertificatePolicyCacheHandle*>( | 49 static_cast<CertificatePolicyCacheHandle*>( |
| 50 browser_state->GetUserData(kCertificatePolicyCacheKeyName)); | 50 browser_state->GetUserData(kCertificatePolicyCacheKeyName)); |
| 51 return handle->policy_cache; | 51 return handle->policy_cache; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 bool BrowserState::HasActiveStateManager(BrowserState* browser_state) { |
| 56 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::UI); |
| 57 return browser_state->GetUserData(kActiveStateManagerKeyName) != nullptr; |
| 58 } |
| 59 |
| 60 // static |
| 55 ActiveStateManager* BrowserState::GetActiveStateManager( | 61 ActiveStateManager* BrowserState::GetActiveStateManager( |
| 56 BrowserState* browser_state) { | 62 BrowserState* browser_state) { |
| 57 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::UI); | 63 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::UI); |
| 58 DCHECK(browser_state); | 64 DCHECK(browser_state); |
| 59 | 65 |
| 60 ActiveStateManagerImpl* active_state_manager = | 66 ActiveStateManagerImpl* active_state_manager = |
| 61 static_cast<ActiveStateManagerImpl*>( | 67 static_cast<ActiveStateManagerImpl*>( |
| 62 browser_state->GetUserData(kActiveStateManagerKeyName)); | 68 browser_state->GetUserData(kActiveStateManagerKeyName)); |
| 63 if (!active_state_manager) { | 69 if (!active_state_manager) { |
| 64 active_state_manager = new ActiveStateManagerImpl(browser_state); | 70 active_state_manager = new ActiveStateManagerImpl(browser_state); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // static | 124 // static |
| 119 BrowserState* BrowserState::FromSupportsUserData( | 125 BrowserState* BrowserState::FromSupportsUserData( |
| 120 base::SupportsUserData* supports_user_data) { | 126 base::SupportsUserData* supports_user_data) { |
| 121 if (!supports_user_data || | 127 if (!supports_user_data || |
| 122 !supports_user_data->GetUserData(kBrowserStateIdentifierKey)) { | 128 !supports_user_data->GetUserData(kBrowserStateIdentifierKey)) { |
| 123 return nullptr; | 129 return nullptr; |
| 124 } | 130 } |
| 125 return static_cast<BrowserState*>(supports_user_data); | 131 return static_cast<BrowserState*>(supports_user_data); |
| 126 } | 132 } |
| 127 } // namespace web | 133 } // namespace web |
| OLD | NEW |