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

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

Issue 12902030: Make Encryptor a component. Used by //chrome and (soon) //components/webdata. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove duplicate include. Created 7 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
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 "chrome/browser/password_manager/encryptor_password_mac.h" 5 #include "components/webdata/encryptor/encryptor_password_mac.h"
6 6
7 #import <Security/Security.h> 7 #import <Security/Security.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/mac/mac_logging.h" 10 #include "base/mac/mac_logging.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "crypto/apple_keychain.h" 12 #include "crypto/apple_keychain.h"
13 #include "ui/base/l10n/l10n_util.h"
14 13
15 using crypto::AppleKeychain; 14 using crypto::AppleKeychain;
16 15
17 namespace { 16 namespace {
18 17
19 // Generates a random password and adds it to the Keychain. The added password 18 // Generates a random password and adds it to the Keychain. The added password
20 // is returned from the function. If an error occurs, an empty password is 19 // is returned from the function. If an error occurs, an empty password is
21 // returned. 20 // returned.
22 std::string AddRandomPasswordToKeychain(const AppleKeychain& keychain, 21 std::string AddRandomPasswordToKeychain(const AppleKeychain& keychain,
23 const std::string& service_name, 22 const std::string& service_name,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 std::string(static_cast<char*>(password_data), password_length); 70 std::string(static_cast<char*>(password_data), password_length);
72 keychain_.ItemFreeContent(NULL, password_data); 71 keychain_.ItemFreeContent(NULL, password_data);
73 return password; 72 return password;
74 } else if (error == errSecItemNotFound) { 73 } else if (error == errSecItemNotFound) {
75 return AddRandomPasswordToKeychain(keychain_, service_name, account_name); 74 return AddRandomPasswordToKeychain(keychain_, service_name, account_name);
76 } else { 75 } else {
77 OSSTATUS_DLOG(ERROR, error) << "Keychain lookup failed"; 76 OSSTATUS_DLOG(ERROR, error) << "Keychain lookup failed";
78 return std::string(); 77 return std::string();
79 } 78 }
80 } 79 }
OLDNEW
« no previous file with comments | « components/webdata/encryptor/encryptor_password_mac.h ('k') | components/webdata/encryptor/encryptor_password_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698