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

Side by Side Diff: chrome/browser/net/cookie_store_util.cc

Issue 183953005: Rename components's Encryptor to OSEncrypt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: similarity Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_profile_service_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/net/cookie_store_util.h" 5 #include "chrome/browser/net/cookie_store_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/net/chrome_cookie_notification_details.h" 13 #include "chrome/browser/net/chrome_cookie_notification_details.h"
14 #include "chrome/browser/net/evicted_domain_cookie_counter.h" 14 #include "chrome/browser/net/evicted_domain_cookie_counter.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "components/encryptor/encryptor.h" 19 #include "components/encryptor/os_crypt.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/cookie_crypto_delegate.h" 21 #include "content/public/browser/cookie_crypto_delegate.h"
22 #include "content/public/browser/cookie_store_factory.h" 22 #include "content/public/browser/cookie_store_factory.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "content/public/common/content_constants.h" 24 #include "content/public/common/content_constants.h"
25 #include "extensions/common/constants.h" 25 #include "extensions/common/constants.h"
26 26
27 using content::BrowserThread; 27 using content::BrowserThread;
28 28
29 namespace { 29 namespace {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 102 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
103 namespace { 103 namespace {
104 104
105 // Use the operating system's mechanisms to encrypt cookies before writing 105 // Use the operating system's mechanisms to encrypt cookies before writing
106 // them to persistent store. Currently this only is done with desktop OS's 106 // them to persistent store. Currently this only is done with desktop OS's
107 // because ChromeOS and Android already protect the entire profile contents. 107 // because ChromeOS and Android already protect the entire profile contents.
108 // 108 //
109 // TODO(bcwhite): Enable on MACOSX -- requires all Cookie tests to call 109 // TODO(bcwhite): Enable on MACOSX -- requires all Cookie tests to call
110 // Encryptor::UseMockKeychain or will hang waiting for user input. 110 // OSCrypt::UseMockKeychain or will hang waiting for user input.
111 class CookieOSCryptoDelegate : public content::CookieCryptoDelegate { 111 class CookieOSCryptoDelegate : public content::CookieCryptoDelegate {
112 public: 112 public:
113 virtual bool EncryptString(const std::string& plaintext, 113 virtual bool EncryptString(const std::string& plaintext,
114 std::string* ciphertext) OVERRIDE; 114 std::string* ciphertext) OVERRIDE;
115 virtual bool DecryptString(const std::string& ciphertext, 115 virtual bool DecryptString(const std::string& ciphertext,
116 std::string* plaintext) OVERRIDE; 116 std::string* plaintext) OVERRIDE;
117 }; 117 };
118 118
119 bool CookieOSCryptoDelegate::EncryptString(const std::string& plaintext, 119 bool CookieOSCryptoDelegate::EncryptString(const std::string& plaintext,
120 std::string* ciphertext) { 120 std::string* ciphertext) {
121 return Encryptor::EncryptString(plaintext, ciphertext); 121 return OSCrypt::EncryptString(plaintext, ciphertext);
122 } 122 }
123 123
124 bool CookieOSCryptoDelegate::DecryptString(const std::string& ciphertext, 124 bool CookieOSCryptoDelegate::DecryptString(const std::string& ciphertext,
125 std::string* plaintext) { 125 std::string* plaintext) {
126 return Encryptor::DecryptString(ciphertext, plaintext); 126 return OSCrypt::DecryptString(ciphertext, plaintext);
127 } 127 }
128 128
129 // Using a LazyInstance is safe here because this class is stateless and 129 // Using a LazyInstance is safe here because this class is stateless and
130 // requires 0 initialization. 130 // requires 0 initialization.
131 base::LazyInstance<CookieOSCryptoDelegate> g_cookie_crypto_delegate = 131 base::LazyInstance<CookieOSCryptoDelegate> g_cookie_crypto_delegate =
132 LAZY_INSTANCE_INITIALIZER; 132 LAZY_INSTANCE_INITIALIZER;
133 133
134 } // namespace 134 } // namespace
135 135
136 content::CookieCryptoDelegate* GetCookieCryptoDelegate() { 136 content::CookieCryptoDelegate* GetCookieCryptoDelegate() {
137 return g_cookie_crypto_delegate.Pointer(); 137 return g_cookie_crypto_delegate.Pointer();
138 } 138 }
139 #else // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 139 #else // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
140 content::CookieCryptoDelegate* GetCookieCryptoDelegate() { 140 content::CookieCryptoDelegate* GetCookieCryptoDelegate() {
141 return NULL; 141 return NULL;
142 } 142 }
143 #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 143 #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
144 144
145 } // namespace chrome_browser_net 145 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_profile_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698