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

Side by Side Diff: ios/net/cookies/cookie_store_ios.mm

Issue 2423803002: Removed use of IsRunningOnIOS8OrLater (Closed)
Patch Set: Created 4 years, 2 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/net/cookies/cookie_creation_time_manager_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 base::FilePath path = base::mac::GetUserLibraryPath(); 114 base::FilePath path = base::mac::GetUserLibraryPath();
115 // The relative path of the file (from the user library folder) where 115 // The relative path of the file (from the user library folder) where
116 // WKWebView stores its cookies. 116 // WKWebView stores its cookies.
117 const std::string kCookiesFilePath = "Cookies/Cookies.binarycookies"; 117 const std::string kCookiesFilePath = "Cookies/Cookies.binarycookies";
118 return path.Append(kCookiesFilePath); 118 return path.Append(kCookiesFilePath);
119 } 119 }
120 120
121 // Clears all cookies from the .binarycookies file. 121 // Clears all cookies from the .binarycookies file.
122 // Must be called from a thread where IO operations are allowed. 122 // Must be called from a thread where IO operations are allowed.
123 // Preconditions: There must be no active WKWebViews present in the app. 123 // Preconditions: There must be no active WKWebViews present in the app.
124 // Note that the .binarycookies file is present only on iOS8+.
124 void ClearAllCookiesFromBinaryCookiesFile() { 125 void ClearAllCookiesFromBinaryCookiesFile() {
125 // The .binarycookies file is present only on iOS8+.
126 if (!base::ios::IsRunningOnIOS8OrLater()) {
127 return;
128 }
129 base::FilePath path = GetBinaryCookiesFilePath(); 126 base::FilePath path = GetBinaryCookiesFilePath();
130 if (base::PathExists(path)) { 127 if (base::PathExists(path)) {
131 bool success = base::DeleteFile(path, false); 128 bool success = base::DeleteFile(path, false);
132 if (!success) { 129 if (!success) {
133 DLOG(WARNING) << "Failed to remove binarycookies file."; 130 DLOG(WARNING) << "Failed to remove binarycookies file.";
134 } 131 }
135 } 132 }
136 } 133 }
137 134
138 // Builds a NSHTTPCookie from a header cookie line ("Set-Cookie: xxx") and a 135 // Builds a NSHTTPCookie from a header cookie line ("Set-Cookie: xxx") and a
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 weak_factory_.GetWeakPtr(), callback); 1155 weak_factory_.GetWeakPtr(), callback);
1159 } 1156 }
1160 1157
1161 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { 1158 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) {
1162 DCHECK(thread_checker_.CalledOnValidThread()); 1159 DCHECK(thread_checker_.CalledOnValidThread());
1163 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, 1160 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure,
1164 weak_factory_.GetWeakPtr(), callback); 1161 weak_factory_.GetWeakPtr(), callback);
1165 } 1162 }
1166 1163
1167 } // namespace net 1164 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_creation_time_manager_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698