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 3// found in the LICENSE file. 4 5#include "chrome/browser/mac/security_wrappers.h" 6 7#include <Security/Security.h> 8 9#include "base/mac/mac_logging.h" 10 11namespace chrome { 12 13ScopedSecKeychainSetUserInteractionAllowed:: 14 ScopedSecKeychainSetUserInteractionAllowed(Boolean allowed) { 15 OSStatus status = SecKeychainGetUserInteractionAllowed(&old_allowed_); 16 if (status != errSecSuccess) { 17 OSSTATUS_LOG(ERROR, status); 18 old_allowed_ = TRUE; 19 } 20 21 status = SecKeychainSetUserInteractionAllowed(allowed); 22 if (status != errSecSuccess) { 23 OSSTATUS_LOG(ERROR, status); 24 } 25} 26 27ScopedSecKeychainSetUserInteractionAllowed:: 28 ~ScopedSecKeychainSetUserInteractionAllowed() { 29 OSStatus status = SecKeychainSetUserInteractionAllowed(old_allowed_); 30 if (status != errSecSuccess) { 31 OSSTATUS_LOG(ERROR, status); 32 } 33} 34 35} // namespace chrome 36