OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ios/net/cookies/cookie_store_ios.h" | 5 #include "ios/net/cookies/cookie_store_ios.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/ios/ios_util.h" | 12 #include "base/ios/ios_util.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/mac/foundation_util.h" | 15 #include "base/mac/foundation_util.h" |
16 #include "base/mac/scoped_nsobject.h" | 16 #include "base/mac/scoped_nsobject.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/message_loop/message_loop_proxy.h" | |
19 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
20 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
21 #include "base/sequenced_task_runner.h" | 20 #include "base/sequenced_task_runner.h" |
22 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
23 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
24 #include "base/task_runner_util.h" | 23 #include "base/task_runner_util.h" |
| 24 #include "base/thread_task_runner_handle.h" |
25 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
26 #include "ios/net/cookies/cookie_creation_time_manager.h" | 26 #include "ios/net/cookies/cookie_creation_time_manager.h" |
27 #include "ios/net/cookies/cookie_store_ios_client.h" | 27 #include "ios/net/cookies/cookie_store_ios_client.h" |
28 #include "ios/net/cookies/system_cookie_util.h" | 28 #include "ios/net/cookies/system_cookie_util.h" |
29 #import "net/base/mac/url_conversions.h" | 29 #import "net/base/mac/url_conversions.h" |
30 #include "net/cookies/cookie_util.h" | 30 #include "net/cookies/cookie_util.h" |
31 #include "url/gurl.h" | 31 #include "url/gurl.h" |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 RunCallbacksForCookies(key.first, key.second, added_cookies, false); | 791 RunCallbacksForCookies(key.first, key.second, added_cookies, false); |
792 } | 792 } |
793 } | 793 } |
794 | 794 |
795 // Do not schedule a flush if one is already scheduled. | 795 // Do not schedule a flush if one is already scheduled. |
796 if (!flush_closure_.IsCancelled()) | 796 if (!flush_closure_.IsCancelled()) |
797 return; | 797 return; |
798 | 798 |
799 flush_closure_.Reset(base::Bind(&CookieStoreIOS::Flush, | 799 flush_closure_.Reset(base::Bind(&CookieStoreIOS::Flush, |
800 base::Unretained(this), base::Closure())); | 800 base::Unretained(this), base::Closure())); |
801 base::MessageLoopProxy::current()->PostDelayedTask( | 801 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
802 FROM_HERE, flush_closure_.callback(), flush_delay_); | 802 FROM_HERE, flush_closure_.callback(), flush_delay_); |
803 } | 803 } |
804 | 804 |
805 scoped_ptr<net::CookieStore::CookieChangedSubscription> | 805 scoped_ptr<net::CookieStore::CookieChangedSubscription> |
806 CookieStoreIOS::AddCallbackForCookie(const GURL& gurl, | 806 CookieStoreIOS::AddCallbackForCookie(const GURL& gurl, |
807 const std::string& name, | 807 const std::string& name, |
808 const CookieChangedCallback& callback) { | 808 const CookieChangedCallback& callback) { |
809 DCHECK(thread_checker_.CalledOnValidThread()); | 809 DCHECK(thread_checker_.CalledOnValidThread()); |
810 | 810 |
811 // Prefill cookie cache with all pertinent cookies for |url| if needed. | 811 // Prefill cookie cache with all pertinent cookies for |url| if needed. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 DCHECK(thread_checker_.CalledOnValidThread()); | 952 DCHECK(thread_checker_.CalledOnValidThread()); |
953 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); | 953 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); |
954 } | 954 } |
955 | 955 |
956 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { | 956 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { |
957 DCHECK(thread_checker_.CalledOnValidThread()); | 957 DCHECK(thread_checker_.CalledOnValidThread()); |
958 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); | 958 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); |
959 } | 959 } |
960 | 960 |
961 } // namespace net | 961 } // namespace net |
OLD | NEW |