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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/cookies/CanonicalCookie.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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/cookies/CookiesFetcher.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 java.io.DataInputStream; 7 import java.io.DataInputStream;
8 import java.io.DataOutputStream; 8 import java.io.DataOutputStream;
9 import java.io.IOException; 9 import java.io.IOException;
10 10
11 /** 11 /**
12 * Java representation of net/cookies/canonical_cookie.h. 12 * Java representation of net/cookies/canonical_cookie.h.
13 */ 13 */
14 class CanonicalCookie { 14 class CanonicalCookie {
15 private final String mUrl; 15 private final String mUrl;
16 private final String mName; 16 private final String mName;
17 private final String mValue; 17 private final String mValue;
18 private final String mDomain; 18 private final String mDomain;
19 private final String mPath; 19 private final String mPath;
20 private final long mCreation; 20 private final long mCreation;
21 private final long mExpiration; 21 private final long mExpiration;
22 private final long mLastAccess; 22 private final long mLastAccess;
23 private final boolean mSecure; 23 private final boolean mSecure;
24 private final boolean mHttpOnly; 24 private final boolean mHttpOnly;
25 private final boolean mSameSite; 25 private final int mSameSite;
26 private final int mPriority; 26 private final int mPriority;
27 27
28 /** Constructs a CanonicalCookie */ 28 /** Constructs a CanonicalCookie */
29 CanonicalCookie(String url, String name, String value, String domain, String path, 29 CanonicalCookie(String url, String name, String value, String domain, String path,
30 long creation, long expiration, long lastAccess, boolean secure, boo lean httpOnly, 30 long creation, long expiration, long lastAccess, boolean secure, boo lean httpOnly,
31 boolean sameSite, int priority) { 31 int sameSite, int priority) {
32 mUrl = url; 32 mUrl = url;
33 mName = name; 33 mName = name;
34 mValue = value; 34 mValue = value;
35 mDomain = domain; 35 mDomain = domain;
36 mPath = path; 36 mPath = path;
37 mCreation = creation; 37 mCreation = creation;
38 mExpiration = expiration; 38 mExpiration = expiration;
39 mLastAccess = lastAccess; 39 mLastAccess = lastAccess;
40 mSecure = secure; 40 mSecure = secure;
41 mHttpOnly = httpOnly; 41 mHttpOnly = httpOnly;
42 mSameSite = sameSite; 42 mSameSite = sameSite;
43 mPriority = priority; 43 mPriority = priority;
44 } 44 }
45 45
46 /** @return Priority of the cookie. */ 46 /** @return Priority of the cookie. */
47 int getPriority() { 47 int getPriority() {
48 return mPriority; 48 return mPriority;
49 } 49 }
50 50
51 /** @return True if the cookie is HTTP only. */ 51 /** @return True if the cookie is HTTP only. */
52 boolean isHttpOnly() { 52 boolean isHttpOnly() {
53 return mHttpOnly; 53 return mHttpOnly;
54 } 54 }
55 55
56 /** @return True if the cookie is Same-Site. */ 56 /** @return SameSite enum */
57 boolean isSameSite() { 57 int getSameSite() {
58 return mSameSite; 58 return mSameSite;
59 } 59 }
60 60
61 /** @return True if the cookie is secure. */ 61 /** @return True if the cookie is secure. */
62 boolean isSecure() { 62 boolean isSecure() {
63 return mSecure; 63 return mSecure;
64 } 64 }
65 65
66 /** @return Last accessed time. */ 66 /** @return Last accessed time. */
67 long getLastAccessDate() { 67 long getLastAccessDate() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 out.writeUTF(mUrl); 113 out.writeUTF(mUrl);
114 out.writeUTF(mName); 114 out.writeUTF(mName);
115 out.writeUTF(mValue); 115 out.writeUTF(mValue);
116 out.writeUTF(mDomain); 116 out.writeUTF(mDomain);
117 out.writeUTF(mPath); 117 out.writeUTF(mPath);
118 out.writeLong(mCreation); 118 out.writeLong(mCreation);
119 out.writeLong(mExpiration); 119 out.writeLong(mExpiration);
120 out.writeLong(mLastAccess); 120 out.writeLong(mLastAccess);
121 out.writeBoolean(mSecure); 121 out.writeBoolean(mSecure);
122 out.writeBoolean(mHttpOnly); 122 out.writeBoolean(mHttpOnly);
123 out.writeBoolean(mSameSite); 123 out.writeInt(mSameSite);
boliu 2016/04/18 20:50:22 this should be safe since CookiesFetcher catches T
Yaron 2016/04/19 14:36:13 Confused why you're worried about the write - it's
124 out.writeInt(mPriority); 124 out.writeInt(mPriority);
125 } 125 }
126 126
127 /** 127 /**
128 * Constructs a cookie by deserializing a single entry from the 128 * Constructs a cookie by deserializing a single entry from the
129 * input stream. 129 * input stream.
130 * 130 *
131 * @param in Stream to read a cookie entry from. 131 * @param in Stream to read a cookie entry from.
132 */ 132 */
133 static CanonicalCookie createFromStream(DataInputStream in) 133 static CanonicalCookie createFromStream(DataInputStream in)
134 throws IOException { 134 throws IOException {
135 return new CanonicalCookie(in.readUTF(), in.readUTF(), in.readUTF(), in. readUTF(), 135 return new CanonicalCookie(in.readUTF(), in.readUTF(), in.readUTF(), in. readUTF(),
136 in.readUTF(), in.readLong(), in.readLong(), in.readLong(), in.re adBoolean(), 136 in.readUTF(), in.readLong(), in.readLong(), in.readLong(), in.re adBoolean(),
137 in.readBoolean(), in.readBoolean(), in.readInt()); 137 in.readBoolean(), in.readInt(), in.readInt());
138 } 138 }
139 } 139 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/cookies/CookiesFetcher.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698