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

Unified Diff: components/keyed_service/ios/browser_state_helper.h

Issue 1090373003: Allow cross dependencies between BCKSF and BSKSF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix dependencies and DCHECK in Get{Original,Underlying}ContextInternal Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/keyed_service/ios/browser_state_helper.h
diff --git a/components/keyed_service/ios/browser_state_helper.h b/components/keyed_service/ios/browser_state_helper.h
index 2c4e0b5c433607404910b8acd335e43875d29392..d4d151b44ff6fa78f85ab8a4f18809e30dd3d03c 100644
--- a/components/keyed_service/ios/browser_state_helper.h
+++ b/components/keyed_service/ios/browser_state_helper.h
@@ -13,20 +13,36 @@ namespace web {
class BrowserState;
}
-// TODO(sdefresne): remove this file and all usage of the methods once iOS code
-// only use BrowserStateKeyedServiceFactory, http://crbug.com/419366
+// TODO(ios): remove this file and all usage of the methods once iOS code only
+// use BrowserStateKeyedServiceFactory, http://crbug.com/478763
-// |BrowserStateFromContextFn| converts from a base::SupportsUserData as passed
-// to a (Refcounted)?BrowserStateKeyedServiceFactory to a web::BrowserState.
-using BrowserStateFromContextFn =
+// Typedef for a function converting a base::SupportsUserData to the underlying
+// web::BrowserState.
+using UnderlyingContextFromContextFn =
web::BrowserState* (*)(base::SupportsUserData*);
-// Registers an helper function to convert a |context| to a web::BrowserState
-// to allow the embedder to overrides how the BSKSF does the conversion.
-void SetBrowserStateFromContextHelper(BrowserStateFromContextFn helper);
-
-// Converts a |context| to a web::BrowserState using the helper registered by
-// the embedder if any. Usage is restricted to //components/keyed_service/ios.
-web::BrowserState* BrowserStateFromContext(base::SupportsUserData* context);
+// Registers an |helper| that allows the embedder to control how the underlying
+// web::BrowserState is obtained from a base::SupportsUserData.
+void SetUnderlyingContextFromContextHelper(
+ UnderlyingContextFromContextFn helper);
+
+// Returns the underlying web::BrowserState that corresponds to |context| using
+// the helper registered via SetUnderlyingContextFromContextHelper().
+web::BrowserState* UnderlyingContextFromContext(
+ base::SupportsUserData* context);
+
+// Typedef for a function converting a web::BrowserState to the original
+// base::SupportsUserData.
+using OriginalContextFromContextFn =
+ base::SupportsUserData* (*)(web::BrowserState*);
+
+// Registers an |helper| that allows the embedder to control how the original
+// base::SupportsUserData is obtained from a web::BrowserState.
+void SetOriginalContextFromContextHelper(OriginalContextFromContextFn helper);
+
+// Returns the original base::SupportsUserData that corresponds to |context|
+// using the helper registered via SetOriginalContextFromContextHelper().
+base::SupportsUserData* OriginalContextFromContext(
+ base::SupportsUserData* context);
#endif // COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698