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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/cookies/CookiesFetcher.java

Issue 1894213003: android: Fix CanonicalCookie same_site field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.chrome.browser.cookies; 5 package org.chromium.chrome.browser.cookies;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.AsyncTask; 8 import android.os.AsyncTask;
9 9
10 import org.chromium.base.ImportantFileWriterAndroid; 10 import org.chromium.base.ImportantFileWriterAndroid;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return cookies; 167 return cookies;
168 } 168 }
169 169
170 @Override 170 @Override
171 protected void onPostExecute(List<CanonicalCookie> cookies) { 171 protected void onPostExecute(List<CanonicalCookie> cookies) {
172 // We can only access cookies and profiles on the UI thread. 172 // We can only access cookies and profiles on the UI thread.
173 for (CanonicalCookie cookie : cookies) { 173 for (CanonicalCookie cookie : cookies) {
174 nativeRestoreCookies(cookie.getUrl(), cookie.getName(), cook ie.getValue(), 174 nativeRestoreCookies(cookie.getUrl(), cookie.getName(), cook ie.getValue(),
175 cookie.getDomain(), cookie.getPath(), cookie.getCrea tionDate(), 175 cookie.getDomain(), cookie.getPath(), cookie.getCrea tionDate(),
176 cookie.getExpirationDate(), cookie.getLastAccessDate (), 176 cookie.getExpirationDate(), cookie.getLastAccessDate (),
177 cookie.isSecure(), cookie.isHttpOnly(), cookie.isSam eSite(), 177 cookie.isSecure(), cookie.isHttpOnly(), cookie.getSa meSite(),
178 cookie.getPriority()); 178 cookie.getPriority());
179 } 179 }
180 } 180 }
181 }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); 181 }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
182 } 182 }
183 183
184 /** 184 /**
185 * Ensure the incognito cookies are deleted when the incognito profile is go ne. 185 * Ensure the incognito cookies are deleted when the incognito profile is go ne.
186 * 186 *
187 * @param context Context for accessing the file system. 187 * @param context Context for accessing the file system.
(...skipping 24 matching lines...) Expand all
212 } 212 }
213 } 213 }
214 return null; 214 return null;
215 } 215 }
216 }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); 216 }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
217 } 217 }
218 218
219 @CalledByNative 219 @CalledByNative
220 private CanonicalCookie createCookie(String url, String name, String value, String domain, 220 private CanonicalCookie createCookie(String url, String name, String value, String domain,
221 String path, long creation, long expiration, long lastAccess, boolea n secure, 221 String path, long creation, long expiration, long lastAccess, boolea n secure,
222 boolean httpOnly, boolean sameSite, int priority) { 222 boolean httpOnly, int sameSite, int priority) {
223 return new CanonicalCookie(url, name, value, domain, path, creation, exp iration, lastAccess, 223 return new CanonicalCookie(url, name, value, domain, path, creation, exp iration, lastAccess,
224 secure, httpOnly, sameSite, priority); 224 secure, httpOnly, sameSite, priority);
225 } 225 }
226 226
227 @CalledByNative 227 @CalledByNative
228 private void onCookieFetchFinished(final CanonicalCookie[] cookies) { 228 private void onCookieFetchFinished(final CanonicalCookie[] cookies) {
229 // Cookies fetching requires operations with the profile and must be 229 // Cookies fetching requires operations with the profile and must be
230 // done in the main thread. Once that is done, do the save to disk 230 // done in the main thread. Once that is done, do the save to disk
231 // part in {@link AsyncTask} to avoid strict mode violations. 231 // part in {@link AsyncTask} to avoid strict mode violations.
232 new AsyncTask<Void, Void, Void>() { 232 new AsyncTask<Void, Void, Void>() {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 @CalledByNative 289 @CalledByNative
290 private CanonicalCookie[] createCookiesArray(int size) { 290 private CanonicalCookie[] createCookiesArray(int size) {
291 return new CanonicalCookie[size]; 291 return new CanonicalCookie[size];
292 } 292 }
293 293
294 private native long nativeInit(); 294 private native long nativeInit();
295 private static native void nativeDestroy(long nativeCookiesFetcher); 295 private static native void nativeDestroy(long nativeCookiesFetcher);
296 private native void nativePersistCookies(long nativeCookiesFetcher); 296 private native void nativePersistCookies(long nativeCookiesFetcher);
297 private static native void nativeRestoreCookies(String url, String name, Str ing value, 297 private static native void nativeRestoreCookies(String url, String name, Str ing value,
298 String domain, String path, long creation, long expiration, long las tAccess, 298 String domain, String path, long creation, long expiration, long las tAccess,
299 boolean secure, boolean httpOnly, boolean sameSite, int priority); 299 boolean secure, boolean httpOnly, int sameSite, int priority);
300 } 300 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698