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 #include "ios/web/public/certificate_policy_cache.h" | 10 #include "ios/web/public/certificate_policy_cache.h" |
11 #include "ios/web/public/web_thread.h" | 11 #include "ios/web/public/web_thread.h" |
12 #include "ios/web/webui/url_data_manager_ios_backend.h" | 12 #include "ios/web/webui/url_data_manager_ios_backend.h" |
13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
14 namespace web { | 18 namespace web { |
15 namespace { | 19 namespace { |
16 // Private key used for safe conversion of base::SupportsUserData to | 20 // Private key used for safe conversion of base::SupportsUserData to |
17 // web::BrowserState in web::BrowserState::FromSupportsUserData. | 21 // web::BrowserState in web::BrowserState::FromSupportsUserData. |
18 const char kBrowserStateIdentifierKey[] = "BrowserStateIdentifierKey"; | 22 const char kBrowserStateIdentifierKey[] = "BrowserStateIdentifierKey"; |
19 | 23 |
20 // Data key names. | 24 // Data key names. |
21 const char kCertificatePolicyCacheKeyName[] = "cert_policy_cache"; | 25 const char kCertificatePolicyCacheKeyName[] = "cert_policy_cache"; |
22 const char kActiveStateManagerKeyName[] = "active_state_manager"; | 26 const char kActiveStateManagerKeyName[] = "active_state_manager"; |
23 | 27 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // static | 109 // static |
106 BrowserState* BrowserState::FromSupportsUserData( | 110 BrowserState* BrowserState::FromSupportsUserData( |
107 base::SupportsUserData* supports_user_data) { | 111 base::SupportsUserData* supports_user_data) { |
108 if (!supports_user_data || | 112 if (!supports_user_data || |
109 !supports_user_data->GetUserData(kBrowserStateIdentifierKey)) { | 113 !supports_user_data->GetUserData(kBrowserStateIdentifierKey)) { |
110 return nullptr; | 114 return nullptr; |
111 } | 115 } |
112 return static_cast<BrowserState*>(supports_user_data); | 116 return static_cast<BrowserState*>(supports_user_data); |
113 } | 117 } |
114 } // namespace web | 118 } // namespace web |
OLD | NEW |