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

Side by Side Diff: components/webdata/encryptor/encryptor_mac.mm

Issue 112433004: Update uses of UTF conversions in chrome_frame/, chromeos/, components/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/webdata/encryptor/encryptor.h" 5 #include "components/webdata/encryptor/encryptor.h"
6 6
7 #include <CommonCrypto/CommonCryptor.h> // for kCCBlockSizeAES128 7 #include <CommonCrypto/CommonCryptor.h> // for kCCBlockSizeAES128
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 kDerivedKeySizeInBits)); 64 kDerivedKeySizeInBits));
65 DCHECK(encryption_key.get()); 65 DCHECK(encryption_key.get());
66 66
67 return encryption_key.release(); 67 return encryption_key.release();
68 } 68 }
69 69
70 } // namespace 70 } // namespace
71 71
72 bool Encryptor::EncryptString16(const base::string16& plaintext, 72 bool Encryptor::EncryptString16(const base::string16& plaintext,
73 std::string* ciphertext) { 73 std::string* ciphertext) {
74 return EncryptString(UTF16ToUTF8(plaintext), ciphertext); 74 return EncryptString(base::UTF16ToUTF8(plaintext), ciphertext);
75 } 75 }
76 76
77 bool Encryptor::DecryptString16(const std::string& ciphertext, 77 bool Encryptor::DecryptString16(const std::string& ciphertext,
78 base::string16* plaintext) { 78 base::string16* plaintext) {
79 std::string utf8; 79 std::string utf8;
80 if (!DecryptString(ciphertext, &utf8)) 80 if (!DecryptString(ciphertext, &utf8))
81 return false; 81 return false;
82 82
83 *plaintext = UTF8ToUTF16(utf8); 83 *plaintext = base::UTF8ToUTF16(utf8);
84 return true; 84 return true;
85 } 85 }
86 86
87 bool Encryptor::EncryptString(const std::string& plaintext, 87 bool Encryptor::EncryptString(const std::string& plaintext,
88 std::string* ciphertext) { 88 std::string* ciphertext) {
89 if (plaintext.empty()) { 89 if (plaintext.empty()) {
90 *ciphertext = std::string(); 90 *ciphertext = std::string();
91 return true; 91 return true;
92 } 92 }
93 93
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (!encryptor.Decrypt(raw_ciphertext, plaintext)) 141 if (!encryptor.Decrypt(raw_ciphertext, plaintext))
142 return false; 142 return false;
143 143
144 return true; 144 return true;
145 } 145 }
146 146
147 void Encryptor::UseMockKeychain(bool use_mock) { 147 void Encryptor::UseMockKeychain(bool use_mock) {
148 use_mock_keychain = use_mock; 148 use_mock_keychain = use_mock;
149 } 149 }
150 150
OLDNEW
« no previous file with comments | « components/webdata/common/web_database_migration_unittest.cc ('k') | components/webdata/encryptor/encryptor_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698