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

Side by Side 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, 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "ios/web/net/cookie_notification_bridge.h"
6
7 #import <Foundation/Foundation.h>
8
9 #include "base/bind.h"
10 #include "base/location.h"
11 #include "ios/net/cookies/cookie_store_ios.h"
12 #include "ios/web/public/web_thread.h"
13
14 namespace web {
15
16 CookieNotificationBridge::CookieNotificationBridge() {
17 observer_.reset([[NSNotificationCenter defaultCenter]
18 addObserverForName:NSHTTPCookieManagerCookiesChangedNotification
19 object:[NSHTTPCookieStorage sharedHTTPCookieStorage]
20 queue:nil
21 usingBlock:^(NSNotification* notification) {
22 OnNotificationReceived(notification);
23 }]);
24 }
25
26 CookieNotificationBridge::~CookieNotificationBridge() {
27 [[NSNotificationCenter defaultCenter] removeObserver:observer_];
28 }
29
30 void CookieNotificationBridge::OnNotificationReceived(
31 NSNotification* notification) {
32 DCHECK(thread_checker_.CalledOnValidThread());
33 DCHECK([[notification name]
34 isEqualToString:NSHTTPCookieManagerCookiesChangedNotification]);
35 web::WebThread::PostTask(
36 web::WebThread::IO, FROM_HERE,
37 base::Bind(&net::CookieStoreIOS::NotifySystemCookiesChanged));
38 }
39
40 } // namespace web
OLDNEW
« 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