1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_HELPER_H_
6 #define COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_HELPER_H_
9 class SupportsUserData
;
16 // TODO(sdefresne): remove this file and all usage of the methods once iOS code
17 // only use BrowserStateKeyedServiceFactory, http://crbug.com/419366
19 // |BrowserStateFromContextFn| converts from a base::SupportsUserData as passed
20 // to a (Refcounted)?BrowserStateKeyedServiceFactory to a web::BrowserState.
21 using BrowserStateFromContextFn
=
22 web::BrowserState
* (*)(base::SupportsUserData
*);
24 // Registers an helper function to convert a |context| to a web::BrowserState
25 // to allow the embedder to overrides how the BSKSF does the conversion.
26 void SetBrowserStateFromContextHelper(BrowserStateFromContextFn helper
);
28 // Converts a |context| to a web::BrowserState using the helper registered by
29 // the embedder if any. Usage is restricted to //components/keyed_service/ios.
30 web::BrowserState
* BrowserStateFromContext(base::SupportsUserData
* context
);
32 #endif // COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_HELPER_H_