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

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

Issue 2159373002: net: make CanonicalCookie's constructor private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: domain Created 4 years, 5 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 | ios/net/cookies/cookie_cache_unittest.cc » ('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 #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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 jint priority) { 150 jint priority) {
151 Profile* profile = ProfileManager::GetPrimaryUserProfile(); 151 Profile* profile = ProfileManager::GetPrimaryUserProfile();
152 if (!profile->HasOffTheRecordProfile()) { 152 if (!profile->HasOffTheRecordProfile()) {
153 return; // Don't create it. There is nothing to do. 153 return; // Don't create it. There is nothing to do.
154 } 154 }
155 profile = profile->GetOffTheRecordProfile(); 155 profile = profile->GetOffTheRecordProfile();
156 156
157 scoped_refptr<net::URLRequestContextGetter> getter( 157 scoped_refptr<net::URLRequestContextGetter> getter(
158 profile->GetRequestContext()); 158 profile->GetRequestContext());
159 159
160 net::CanonicalCookie cookie( 160 net::CanonicalCookie cookie(*net::CanonicalCookie::Create(
161 GURL(), base::android::ConvertJavaStringToUTF8(env, name), 161 base::android::ConvertJavaStringToUTF8(env, name),
162 base::android::ConvertJavaStringToUTF8(env, value), 162 base::android::ConvertJavaStringToUTF8(env, value),
163 base::android::ConvertJavaStringToUTF8(env, domain), 163 base::android::ConvertJavaStringToUTF8(env, domain),
164 base::android::ConvertJavaStringToUTF8(env, path), 164 base::android::ConvertJavaStringToUTF8(env, path),
165 base::Time::FromInternalValue(creation), 165 base::Time::FromInternalValue(creation),
166 base::Time::FromInternalValue(expiration), 166 base::Time::FromInternalValue(expiration),
167 base::Time::FromInternalValue(last_access), secure, httponly, 167 base::Time::FromInternalValue(last_access),
168 secure, httponly,
168 static_cast<net::CookieSameSite>(same_site), 169 static_cast<net::CookieSameSite>(same_site),
169 static_cast<net::CookiePriority>(priority)); 170 static_cast<net::CookiePriority>(priority)));
170 171
171 // The rest must be done from the IO thread. 172 // The rest must be done from the IO thread.
172 content::BrowserThread::PostTask( 173 content::BrowserThread::PostTask(
173 content::BrowserThread::IO, FROM_HERE, 174 content::BrowserThread::IO, FROM_HERE,
174 base::Bind(&RestoreToCookieJarInternal, base::RetainedRef(getter), 175 base::Bind(&RestoreToCookieJarInternal, base::RetainedRef(getter),
175 cookie)); 176 cookie));
176 } 177 }
177 178
178 // JNI functions 179 // JNI functions
179 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 180 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
180 return reinterpret_cast<intptr_t>(new CookiesFetcher(env, obj, 0)); 181 return reinterpret_cast<intptr_t>(new CookiesFetcher(env, obj, 0));
181 } 182 }
182 183
183 // Register native methods 184 // Register native methods
184 bool RegisterCookiesFetcher(JNIEnv* env) { 185 bool RegisterCookiesFetcher(JNIEnv* env) {
185 return RegisterNativesImpl(env); 186 return RegisterNativesImpl(env);
186 } 187 }
OLDNEW
« no previous file with comments | « no previous file | ios/net/cookies/cookie_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698