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/chrome/browser/net/cookie_util.h" | 5 #include "ios/chrome/browser/net/cookie_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <sys/sysctl.h> | 9 #include <sys/sysctl.h> |
10 | 10 |
| 11 #include <cstdint> |
| 12 |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #import "base/mac/bind_objc_block.h" | 14 #import "base/mac/bind_objc_block.h" |
13 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/task_scheduler/post_task.h" | 17 #include "base/task_scheduler/post_task.h" |
16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
17 #include "ios/net/cookies/cookie_store_ios_persistent.h" | 19 #include "ios/net/cookies/cookie_store_ios_persistent.h" |
18 #include "ios/web/public/web_thread.h" | 20 #include "ios/web/public/web_thread.h" |
19 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
20 #include "net/cookies/cookie_store.h" | 22 #include "net/cookies/cookie_store.h" |
21 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h" | 23 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h" |
22 #include "net/url_request/url_request_context.h" | 24 #include "net/url_request/url_request_context.h" |
23 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
24 | 26 |
25 #if !defined(__has_feature) || !__has_feature(objc_arc) | 27 #if !defined(__has_feature) || !__has_feature(objc_arc) |
26 #error "This file requires ARC support." | 28 #error "This file requires ARC support." |
27 #endif | 29 #endif |
28 | 30 |
29 namespace cookie_util { | 31 namespace cookie_util { |
30 | 32 |
31 namespace { | 33 namespace { |
32 | 34 |
33 // Date of the last cookie deletion. | 35 // Date of the last cookie deletion. |
34 NSString* const kLastCookieDeletionDate = @"LastCookieDeletionDate"; | 36 NSString* const kLastCookieDeletionDate = @"LastCookieDeletionDate"; |
35 | 37 |
36 // Empty callback. | 38 // Empty callback. |
37 void DoNothing(int n) {} | 39 void DoNothing(uint32_t n) {} |
38 | 40 |
39 // Creates a SQLitePersistentCookieStore running on a background thread. | 41 // Creates a SQLitePersistentCookieStore running on a background thread. |
40 scoped_refptr<net::SQLitePersistentCookieStore> CreatePersistentCookieStore( | 42 scoped_refptr<net::SQLitePersistentCookieStore> CreatePersistentCookieStore( |
41 const base::FilePath& path, | 43 const base::FilePath& path, |
42 bool restore_old_session_cookies, | 44 bool restore_old_session_cookies, |
43 net::CookieCryptoDelegate* crypto_delegate) { | 45 net::CookieCryptoDelegate* crypto_delegate) { |
44 return scoped_refptr<net::SQLitePersistentCookieStore>( | 46 return scoped_refptr<net::SQLitePersistentCookieStore>( |
45 new net::SQLitePersistentCookieStore( | 47 new net::SQLitePersistentCookieStore( |
46 path, web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), | 48 path, web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), |
47 base::CreateSequencedTaskRunnerWithTraits( | 49 base::CreateSequencedTaskRunnerWithTraits( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 browser_state->GetRequestContext(); | 128 browser_state->GetRequestContext(); |
127 web::WebThread::PostTask( | 129 web::WebThread::PostTask( |
128 web::WebThread::IO, FROM_HERE, base::BindBlockArc(^{ | 130 web::WebThread::IO, FROM_HERE, base::BindBlockArc(^{ |
129 getter->GetURLRequestContext() | 131 getter->GetURLRequestContext() |
130 ->cookie_store() | 132 ->cookie_store() |
131 ->DeleteSessionCookiesAsync(base::Bind(&DoNothing)); | 133 ->DeleteSessionCookiesAsync(base::Bind(&DoNothing)); |
132 })); | 134 })); |
133 } | 135 } |
134 | 136 |
135 } // namespace cookie_util | 137 } // namespace cookie_util |
OLD | NEW |