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

Side by Side Diff: android_webview/native/cookie_manager.cc

Issue 2791853002: Add a warning for strict secure cookie policy (Closed)
Patch Set: Created 3 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 | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "android_webview/native/cookie_manager.h" 5 #include "android_webview/native/cookie_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "base/threading/sequenced_worker_pool.h" 29 #include "base/threading/sequenced_worker_pool.h"
30 #include "base/threading/thread.h" 30 #include "base/threading/thread.h"
31 #include "base/threading/thread_restrictions.h" 31 #include "base/threading/thread_restrictions.h"
32 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
33 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/cookie_store_factory.h" 34 #include "content/public/browser/cookie_store_factory.h"
35 #include "jni/AwCookieManager_jni.h" 35 #include "jni/AwCookieManager_jni.h"
36 #include "net/cookies/cookie_monster.h" 36 #include "net/cookies/cookie_monster.h"
37 #include "net/cookies/cookie_options.h" 37 #include "net/cookies/cookie_options.h"
38 #include "net/cookies/cookie_store.h" 38 #include "net/cookies/cookie_store.h"
39 #include "net/cookies/parsed_cookie.h"
39 #include "net/extras/sqlite/cookie_crypto_delegate.h" 40 #include "net/extras/sqlite/cookie_crypto_delegate.h"
40 #include "net/url_request/url_request_context.h" 41 #include "net/url_request/url_request_context.h"
41 #include "url/url_constants.h" 42 #include "url/url_constants.h"
42 43
43 using base::FilePath; 44 using base::FilePath;
44 using base::WaitableEvent; 45 using base::WaitableEvent;
45 using base::android::ConvertJavaStringToUTF8; 46 using base::android::ConvertJavaStringToUTF8;
46 using base::android::ConvertJavaStringToUTF16; 47 using base::android::ConvertJavaStringToUTF16;
47 using base::android::JavaParamRef; 48 using base::android::JavaParamRef;
48 using base::android::ScopedJavaGlobalRef; 49 using base::android::ScopedJavaGlobalRef;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 cookie_value)); 379 cookie_value));
379 } 380 }
380 381
381 void CookieManager::SetCookieHelper( 382 void CookieManager::SetCookieHelper(
382 const GURL& host, 383 const GURL& host,
383 const std::string& value, 384 const std::string& value,
384 const BoolCallback callback) { 385 const BoolCallback callback) {
385 net::CookieOptions options; 386 net::CookieOptions options;
386 options.set_include_httponly(); 387 options.set_include_httponly();
387 388
389 // Log message for catching strict secure cookies related bugs.
390 if (!host.has_scheme() || host.SchemeIs(url::kHttpScheme)) {
391 net::ParsedCookie parsed_cookie(value);
392 if (parsed_cookie.IsValid() && parsed_cookie.IsSecure()) {
393 LOG(WARNING) << "Strict Secure Cookie policy does not allow setting a "
394 "secure cookie for "
395 << host.spec();
396 }
397 }
398
388 GetCookieStore()->SetCookieWithOptionsAsync(host, value, options, callback); 399 GetCookieStore()->SetCookieWithOptionsAsync(host, value, options, callback);
389 } 400 }
390 401
391 std::string CookieManager::GetCookie(const GURL& host) { 402 std::string CookieManager::GetCookie(const GURL& host) {
392 std::string cookie_value; 403 std::string cookie_value;
393 ExecCookieTaskSync(base::Bind(&CookieManager::GetCookieValueAsyncHelper, 404 ExecCookieTaskSync(base::Bind(&CookieManager::GetCookieValueAsyncHelper,
394 base::Unretained(this), 405 base::Unretained(this),
395 host, 406 host,
396 &cookie_value)); 407 &cookie_value));
397 return cookie_value; 408 return cookie_value;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 629
619 net::CookieStore* GetCookieStore() { 630 net::CookieStore* GetCookieStore() {
620 return CookieManager::GetInstance()->GetCookieStore(); 631 return CookieManager::GetInstance()->GetCookieStore();
621 } 632 }
622 633
623 bool RegisterCookieManager(JNIEnv* env) { 634 bool RegisterCookieManager(JNIEnv* env) {
624 return RegisterNativesImpl(env); 635 return RegisterNativesImpl(env);
625 } 636 }
626 637
627 } // android_webview namespace 638 } // android_webview namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698