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

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

Issue 2874843002: Shifted creation of unvalidated CanonicalCookies over to a constructor. (Closed)
Patch Set: Merged to top of dependent CL. Created 3 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 | « no previous file | chrome/browser/extensions/api/cookies/cookies_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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 jint priority) { 144 jint priority) {
145 Profile* profile = ProfileManager::GetPrimaryUserProfile(); 145 Profile* profile = ProfileManager::GetPrimaryUserProfile();
146 if (!profile->HasOffTheRecordProfile()) { 146 if (!profile->HasOffTheRecordProfile()) {
147 return; // Don't create it. There is nothing to do. 147 return; // Don't create it. There is nothing to do.
148 } 148 }
149 profile = profile->GetOffTheRecordProfile(); 149 profile = profile->GetOffTheRecordProfile();
150 150
151 scoped_refptr<net::URLRequestContextGetter> getter( 151 scoped_refptr<net::URLRequestContextGetter> getter(
152 profile->GetRequestContext()); 152 profile->GetRequestContext());
153 153
154 net::CanonicalCookie cookie(*net::CanonicalCookie::Create( 154 net::CanonicalCookie cookie(
155 base::android::ConvertJavaStringToUTF8(env, name), 155 base::android::ConvertJavaStringToUTF8(env, name),
156 base::android::ConvertJavaStringToUTF8(env, value), 156 base::android::ConvertJavaStringToUTF8(env, value),
157 base::android::ConvertJavaStringToUTF8(env, domain), 157 base::android::ConvertJavaStringToUTF8(env, domain),
158 base::android::ConvertJavaStringToUTF8(env, path), 158 base::android::ConvertJavaStringToUTF8(env, path),
159 base::Time::FromInternalValue(creation), 159 base::Time::FromInternalValue(creation),
160 base::Time::FromInternalValue(expiration), 160 base::Time::FromInternalValue(expiration),
161 base::Time::FromInternalValue(last_access), 161 base::Time::FromInternalValue(last_access), secure, httponly,
162 secure, httponly,
163 static_cast<net::CookieSameSite>(same_site), 162 static_cast<net::CookieSameSite>(same_site),
164 static_cast<net::CookiePriority>(priority))); 163 static_cast<net::CookiePriority>(priority));
165 164
166 // The rest must be done from the IO thread. 165 // The rest must be done from the IO thread.
167 content::BrowserThread::PostTask( 166 content::BrowserThread::PostTask(
168 content::BrowserThread::IO, FROM_HERE, 167 content::BrowserThread::IO, FROM_HERE,
169 base::Bind(&RestoreToCookieJarInternal, base::RetainedRef(getter), 168 base::Bind(&RestoreToCookieJarInternal, base::RetainedRef(getter),
170 cookie)); 169 cookie));
171 } 170 }
172 171
173 // JNI functions 172 // JNI functions
174 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 173 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
175 return reinterpret_cast<intptr_t>(new CookiesFetcher(env, obj, 0)); 174 return reinterpret_cast<intptr_t>(new CookiesFetcher(env, obj, 0));
176 } 175 }
177 176
178 // Register native methods 177 // Register native methods
179 bool RegisterCookiesFetcher(JNIEnv* env) { 178 bool RegisterCookiesFetcher(JNIEnv* env) {
180 return RegisterNativesImpl(env); 179 return RegisterNativesImpl(env);
181 } 180 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/cookies/cookies_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698