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

Side by Side Diff: chrome/browser/android/cookies/cookies_fetcher.cc

Issue 1894213003: android: Fix CanonicalCookie same_site field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 7 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 | « chrome/android/junit/src/org/chromium/chrome/browser/cookies/CanonicalCookieTest.java ('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 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 #include "base/android/jni_android.h" 5 #include "base/android/jni_android.h"
6 #include "base/android/jni_string.h" 6 #include "base/android/jni_string.h"
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/android/cookies/cookies_fetcher.h" 10 #include "chrome/browser/android/cookies/cookies_fetcher.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const JavaParamRef<jstring>& url, 127 const JavaParamRef<jstring>& url,
128 const JavaParamRef<jstring>& name, 128 const JavaParamRef<jstring>& name,
129 const JavaParamRef<jstring>& value, 129 const JavaParamRef<jstring>& value,
130 const JavaParamRef<jstring>& domain, 130 const JavaParamRef<jstring>& domain,
131 const JavaParamRef<jstring>& path, 131 const JavaParamRef<jstring>& path,
132 jlong creation, 132 jlong creation,
133 jlong expiration, 133 jlong expiration,
134 jlong last_access, 134 jlong last_access,
135 jboolean secure, 135 jboolean secure,
136 jboolean httponly, 136 jboolean httponly,
137 jboolean same_site, 137 jint same_site,
138 jint priority) { 138 jint priority) {
139 Profile* profile = ProfileManager::GetPrimaryUserProfile(); 139 Profile* profile = ProfileManager::GetPrimaryUserProfile();
140 if (!profile->HasOffTheRecordProfile()) { 140 if (!profile->HasOffTheRecordProfile()) {
141 return; // Don't create it. There is nothing to do. 141 return; // Don't create it. There is nothing to do.
142 } 142 }
143 profile = profile->GetOffTheRecordProfile(); 143 profile = profile->GetOffTheRecordProfile();
144 144
145 scoped_refptr<net::URLRequestContextGetter> getter( 145 scoped_refptr<net::URLRequestContextGetter> getter(
146 profile->GetRequestContext()); 146 profile->GetRequestContext());
147 147
148 net::CanonicalCookie cookie( 148 net::CanonicalCookie cookie(
149 GURL(base::android::ConvertJavaStringToUTF8(env, url)), 149 GURL(base::android::ConvertJavaStringToUTF8(env, url)),
150 base::android::ConvertJavaStringToUTF8(env, name), 150 base::android::ConvertJavaStringToUTF8(env, name),
151 base::android::ConvertJavaStringToUTF8(env, value), 151 base::android::ConvertJavaStringToUTF8(env, value),
152 base::android::ConvertJavaStringToUTF8(env, domain), 152 base::android::ConvertJavaStringToUTF8(env, domain),
153 base::android::ConvertJavaStringToUTF8(env, path), 153 base::android::ConvertJavaStringToUTF8(env, path),
154 base::Time::FromInternalValue(creation), 154 base::Time::FromInternalValue(creation),
155 base::Time::FromInternalValue(expiration), 155 base::Time::FromInternalValue(expiration),
156 base::Time::FromInternalValue(last_access), secure, httponly, 156 base::Time::FromInternalValue(last_access), secure, httponly,
157 same_site ? net::CookieSameSite::LAX_MODE 157 static_cast<net::CookieSameSite>(same_site),
158 : net::CookieSameSite::NO_RESTRICTION,
159 static_cast<net::CookiePriority>(priority)); 158 static_cast<net::CookiePriority>(priority));
160 159
161 // The rest must be done from the IO thread. 160 // The rest must be done from the IO thread.
162 content::BrowserThread::PostTask( 161 content::BrowserThread::PostTask(
163 content::BrowserThread::IO, FROM_HERE, 162 content::BrowserThread::IO, FROM_HERE,
164 base::Bind(&RestoreToCookieJarInternal, base::RetainedRef(getter), 163 base::Bind(&RestoreToCookieJarInternal, base::RetainedRef(getter),
165 cookie)); 164 cookie));
166 } 165 }
167 166
168 // JNI functions 167 // JNI functions
169 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 168 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
170 return reinterpret_cast<intptr_t>(new CookiesFetcher(env, obj, 0)); 169 return reinterpret_cast<intptr_t>(new CookiesFetcher(env, obj, 0));
171 } 170 }
172 171
173 // Register native methods 172 // Register native methods
174 bool RegisterCookiesFetcher(JNIEnv* env) { 173 bool RegisterCookiesFetcher(JNIEnv* env) {
175 return RegisterNativesImpl(env); 174 return RegisterNativesImpl(env);
176 } 175 }
OLDNEW
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/cookies/CanonicalCookieTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698