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

Side by Side Diff: chrome/browser/password_manager/password_store_mac.cc

Issue 9235084: Add OSSTATUS_LOG API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 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/password_store_mac.h" 5 #include "chrome/browser/password_manager/password_store_mac.h"
6 #include "chrome/browser/password_manager/password_store_mac_internal.h" 6 #include "chrome/browser/password_manager/password_store_mac_internal.h"
7 7
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/mac/mac_logging.h"
15 #include "base/mac/mac_util.h" 16 #include "base/mac/mac_util.h"
16 #include "base/message_loop.h" 17 #include "base/message_loop.h"
17 #include "base/stl_util.h" 18 #include "base/stl_util.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/keychain_mac.h" 21 #include "chrome/browser/keychain_mac.h"
21 #include "chrome/browser/password_manager/login_database.h" 22 #include "chrome/browser/password_manager/login_database.h"
22 #include "chrome/browser/password_manager/password_store_change.h" 23 #include "chrome/browser/password_manager/password_store_change.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 ++entries; 144 ++entries;
144 } 145 }
145 search_attributes_.count = entries; 146 search_attributes_.count = entries;
146 } 147 }
147 148
148 void KeychainSearch::FindMatchingItems(std::vector<SecKeychainItemRef>* items) { 149 void KeychainSearch::FindMatchingItems(std::vector<SecKeychainItemRef>* items) {
149 OSStatus result = keychain_->SearchCreateFromAttributes( 150 OSStatus result = keychain_->SearchCreateFromAttributes(
150 NULL, kSecInternetPasswordItemClass, &search_attributes_, &search_ref_); 151 NULL, kSecInternetPasswordItemClass, &search_attributes_, &search_ref_);
151 152
152 if (result != noErr) { 153 if (result != noErr) {
153 LOG(ERROR) << "Keychain lookup failed with error " << result; 154 OSSTATUS_LOG(ERROR, result) << "Keychain lookup failed";
154 return; 155 return;
155 } 156 }
156 157
157 SecKeychainItemRef keychain_item; 158 SecKeychainItemRef keychain_item;
158 while (keychain_->SearchCopyNext(search_ref_, &keychain_item) == noErr) { 159 while (keychain_->SearchCopyNext(search_ref_, &keychain_item) == noErr) {
159 // Consumer is responsible for freeing the items. 160 // Consumer is responsible for freeing the items.
160 items->push_back(keychain_item); 161 items->push_back(keychain_item);
161 } 162 }
162 163
163 keychain_->Free(search_ref_); 164 keychain_->Free(search_ref_);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 void* password_data; 254 void* password_data;
254 OSStatus result = keychain.ItemCopyAttributesAndData(keychain_item, &attrInfo, 255 OSStatus result = keychain.ItemCopyAttributesAndData(keychain_item, &attrInfo,
255 NULL, &attrList, 256 NULL, &attrList,
256 &password_length, 257 &password_length,
257 &password_data); 258 &password_data);
258 259
259 if (result != noErr) { 260 if (result != noErr) {
260 // We don't log errSecAuthFailed because that just means that the user 261 // We don't log errSecAuthFailed because that just means that the user
261 // chose not to allow us access to the item. 262 // chose not to allow us access to the item.
262 if (result != errSecAuthFailed) { 263 if (result != errSecAuthFailed) {
263 LOG(ERROR) << "Keychain data load failed: " << result; 264 OSSTATUS_LOG(ERROR, result) << "Keychain data load failed";
264 } 265 }
265 return false; 266 return false;
266 } 267 }
267 268
268 UTF8ToUTF16(static_cast<const char *>(password_data), password_length, 269 UTF8ToUTF16(static_cast<const char *>(password_data), password_length,
269 &(form->password_value)); 270 &(form->password_value));
270 271
271 int port = kAnyPort; 272 int port = kAnyPort;
272 std::string server; 273 std::string server;
273 std::string security_domain; 274 std::string security_domain;
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); 1006 owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
1006 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); 1007 for (std::vector<PasswordForm*>::const_iterator i = forms.begin();
1007 i != forms.end(); ++i) { 1008 i != forms.end(); ++i) {
1008 owned_keychain_adapter.RemovePassword(**i); 1009 owned_keychain_adapter.RemovePassword(**i);
1009 } 1010 }
1010 } 1011 }
1011 1012
1012 void PasswordStoreMac::CreateNotificationService() { 1013 void PasswordStoreMac::CreateNotificationService() {
1013 notification_service_.reset(content::NotificationService::Create()); 1014 notification_service_.reset(content::NotificationService::Create());
1014 } 1015 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698