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

Unified Diff: ios/web/net/cookie_notification_bridge.mm

Issue 1043243003: Upstream most of ios/web/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove accidentally-added clients Created 5 years, 9 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
« no previous file with comments | « ios/web/net/cookie_notification_bridge.h ('k') | ios/web/net/crw_request_tracker_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/net/cookie_notification_bridge.mm
diff --git a/ios/web/net/cookie_notification_bridge.mm b/ios/web/net/cookie_notification_bridge.mm
new file mode 100644
index 0000000000000000000000000000000000000000..8ebb9a7bcf78e69c4def4ff78ccb1673292bbcc6
--- /dev/null
+++ b/ios/web/net/cookie_notification_bridge.mm
@@ -0,0 +1,40 @@
+// 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.
+
+#include "ios/web/net/cookie_notification_bridge.h"
+
+#import <Foundation/Foundation.h>
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "ios/net/cookies/cookie_store_ios.h"
+#include "ios/web/public/web_thread.h"
+
+namespace web {
+
+CookieNotificationBridge::CookieNotificationBridge() {
+ observer_.reset([[NSNotificationCenter defaultCenter]
+ addObserverForName:NSHTTPCookieManagerCookiesChangedNotification
+ object:[NSHTTPCookieStorage sharedHTTPCookieStorage]
+ queue:nil
+ usingBlock:^(NSNotification* notification) {
+ OnNotificationReceived(notification);
+ }]);
+}
+
+CookieNotificationBridge::~CookieNotificationBridge() {
+ [[NSNotificationCenter defaultCenter] removeObserver:observer_];
+}
+
+void CookieNotificationBridge::OnNotificationReceived(
+ NSNotification* notification) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK([[notification name]
+ isEqualToString:NSHTTPCookieManagerCookiesChangedNotification]);
+ web::WebThread::PostTask(
+ web::WebThread::IO, FROM_HERE,
+ base::Bind(&net::CookieStoreIOS::NotifySystemCookiesChanged));
+}
+
+} // namespace web
« no previous file with comments | « ios/web/net/cookie_notification_bridge.h ('k') | ios/web/net/crw_request_tracker_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698