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

Unified Diff: chrome/browser/net/cookie_store_util.cc

Issue 1405463006: Componentize CookieOSCryptoDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding OWNERS Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/cookie_store_util.h ('k') | chrome/browser/profiles/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/cookie_store_util.cc
diff --git a/chrome/browser/net/cookie_store_util.cc b/chrome/browser/net/cookie_store_util.cc
deleted file mode 100644
index d3882ef9ef5b99482a2b1e2f5b4f664ec476c71e..0000000000000000000000000000000000000000
--- a/chrome/browser/net/cookie_store_util.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/cookie_store_util.h"
-
-#include "base/lazy_instance.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_switches.h"
-#include "components/os_crypt/os_crypt.h"
-#include "content/public/common/content_constants.h"
-#include "extensions/common/constants.h"
-#include "net/extras/sqlite/cookie_crypto_delegate.h"
-
-namespace chrome_browser_net {
-
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
-namespace {
-
-// Use the operating system's mechanisms to encrypt cookies before writing
-// them to persistent store. Currently this only is done with desktop OS's
-// because ChromeOS and Android already protect the entire profile contents.
-class CookieOSCryptoDelegate : public net::CookieCryptoDelegate {
- public:
- bool ShouldEncrypt() override;
- bool EncryptString(const std::string& plaintext,
- std::string* ciphertext) override;
- bool DecryptString(const std::string& ciphertext,
- std::string* plaintext) override;
-};
-
-bool CookieOSCryptoDelegate::ShouldEncrypt() {
-#if defined(OS_IOS)
- // Cookie encryption is not necessary on iOS, due to OS-protected storage.
- // However, due to https://codereview.chromium.org/135183021/, cookies were
- // accidentally encrypted. In order to allow these cookies to still be used,a
- // a CookieCryptoDelegate is provided that can decrypt existing cookies.
- // However, new cookies will not be encrypted. The alternatives considered
- // were not supplying a delegate at all (thus invalidating all existing
- // encrypted cookies) or in migrating all cookies at once, which may impose
- // startup costs. Eventually, all cookies will get migrated as they are
- // rewritten.
- return false;
-#else
- return true;
-#endif
-}
-
-bool CookieOSCryptoDelegate::EncryptString(const std::string& plaintext,
- std::string* ciphertext) {
- return OSCrypt::EncryptString(plaintext, ciphertext);
-}
-
-bool CookieOSCryptoDelegate::DecryptString(const std::string& ciphertext,
- std::string* plaintext) {
- return OSCrypt::DecryptString(ciphertext, plaintext);
-}
-
-// Using a LazyInstance is safe here because this class is stateless and
-// requires 0 initialization.
-base::LazyInstance<CookieOSCryptoDelegate> g_cookie_crypto_delegate =
- LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
-net::CookieCryptoDelegate* GetCookieCryptoDelegate() {
- return g_cookie_crypto_delegate.Pointer();
-}
-#else // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
-net::CookieCryptoDelegate* GetCookieCryptoDelegate() {
- return NULL;
-}
-#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
-
-} // namespace chrome_browser_net
« no previous file with comments | « chrome/browser/net/cookie_store_util.h ('k') | chrome/browser/profiles/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698