Index: ios/web/net/cookie_notification_bridge.h |
diff --git a/ios/web/net/cookie_notification_bridge.h b/ios/web/net/cookie_notification_bridge.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..36fc70665566f4d0f1d675fea0af8aed183c0e95 |
--- /dev/null |
+++ b/ios/web/net/cookie_notification_bridge.h |
@@ -0,0 +1,31 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_WEB_NET_COOKIE_NOTIFICATION_BRIDGE_H_ |
+#define IOS_WEB_NET_COOKIE_NOTIFICATION_BRIDGE_H_ |
+ |
+#include "base/mac/scoped_nsobject.h" |
+#include "base/threading/thread_checker.h" |
+ |
+namespace web { |
+ |
+// CookieNotificationBridge listens to |
+// NSHTTPCookieManagerCookiesChangedNotification on the main thread and re-sends |
+// it to the cookie store on the IO thread. |
+class CookieNotificationBridge { |
+ public: |
+ CookieNotificationBridge(); |
+ ~CookieNotificationBridge(); |
+ |
+ private: |
+ void OnNotificationReceived(NSNotification* notification); |
+ base::scoped_nsprotocol<id> observer_; |
+ base::ThreadChecker thread_checker_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CookieNotificationBridge); |
+}; |
+ |
+} // namespace web |
+ |
+#endif // IOS_WEB_NET_COOKIE_NOTIFICATION_BRIDGE_H_ |