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" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (!base::ios::IsRunningOnIOS8OrLater()) { | 124 if (!base::ios::IsRunningOnIOS8OrLater()) { |
125 return; | 125 return; |
126 } | 126 } |
127 base::FilePath path = GetBinaryCookiesFilePath(); | 127 base::FilePath path = GetBinaryCookiesFilePath(); |
128 if (base::PathExists(path)) { | 128 if (base::PathExists(path)) { |
129 bool success = base::DeleteFile(path, false); | 129 bool success = base::DeleteFile(path, false); |
130 if (!success) { | 130 if (!success) { |
131 DLOG(WARNING) << "Failed to remove binarycookies file."; | 131 DLOG(WARNING) << "Failed to remove binarycookies file."; |
132 } | 132 } |
133 } | 133 } |
134 // TODO(shreyasv): Should .binarycookies be parsed to find out how many | |
135 // more cookies are deleted? Investigate further if the accuracy of this | |
136 // actually matters to the callback. | |
137 } | 134 } |
138 | 135 |
139 // Builds a NSHTTPCookie from a header cookie line ("Set-Cookie: xxx") and a | 136 // Builds a NSHTTPCookie from a header cookie line ("Set-Cookie: xxx") and a |
140 // URL. | 137 // URL. |
141 NSHTTPCookie* GetNSHTTPCookieFromCookieLine(const std::string& cookie_line, | 138 NSHTTPCookie* GetNSHTTPCookieFromCookieLine(const std::string& cookie_line, |
142 const GURL& url, | 139 const GURL& url, |
143 base::Time server_time) { | 140 base::Time server_time) { |
144 NSURL* nsurl = net::NSURLWithGURL(url); | 141 NSURL* nsurl = net::NSURLWithGURL(url); |
145 NSString* ns_cookie_line = base::SysUTF8ToNSString(cookie_line); | 142 NSString* ns_cookie_line = base::SysUTF8ToNSString(cookie_line); |
146 if (!ns_cookie_line) { | 143 if (!ns_cookie_line) { |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 DCHECK(thread_checker_.CalledOnValidThread()); | 982 DCHECK(thread_checker_.CalledOnValidThread()); |
986 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); | 983 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); |
987 } | 984 } |
988 | 985 |
989 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { | 986 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { |
990 DCHECK(thread_checker_.CalledOnValidThread()); | 987 DCHECK(thread_checker_.CalledOnValidThread()); |
991 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); | 988 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); |
992 } | 989 } |
993 | 990 |
994 } // namespace net | 991 } // namespace net |
OLD | NEW |