Get mac_logging and foundation_util working on iOS


BUG=None
TEST=None


Review URL: https://chromiumcodereview.appspot.com/10690133

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146117 0039d316-1c4b-4281-b951-d872f2087c98
parent c68cb0ef
...@@ -562,6 +562,8 @@ ...@@ -562,6 +562,8 @@
['include', '^file_util_mac\\.'], ['include', '^file_util_mac\\.'],
['include', '^file_version_info_mac\\.'], ['include', '^file_version_info_mac\\.'],
['include', '^mac/bundle_locations\\.'], ['include', '^mac/bundle_locations\\.'],
['include', '^mac/foundation_util\\.'],
['include', '^mac/mac_logging\\.'],
['include', '^mac/objc_property_releaser\\.'], ['include', '^mac/objc_property_releaser\\.'],
['include', '^mac/scoped_nsautorelease_pool\\.'], ['include', '^mac/scoped_nsautorelease_pool\\.'],
['include', '^message_pump_mac\\.'], ['include', '^message_pump_mac\\.'],
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#if defined(__OBJC__) #if defined(__OBJC__)
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#else // __OBJC__ #else // __OBJC__
#include <CoreFoundation/CoreFoundation.h>
class NSBundle; class NSBundle;
class NSString; class NSString;
#endif // __OBJC__ #endif // __OBJC__
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
#include "base/mac/mac_logging.h" #include "base/mac/mac_logging.h"
#include "base/sys_string_conversions.h" #include "base/sys_string_conversions.h"
#if !defined(OS_IOS)
extern "C" { extern "C" {
CFTypeID SecACLGetTypeID(); CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID(); CFTypeID SecTrustedApplicationGetTypeID();
} // extern "C" } // extern "C"
#endif
namespace base { namespace base {
namespace mac { namespace mac {
...@@ -26,6 +28,10 @@ static bool g_override_am_i_bundled_value = false; ...@@ -26,6 +28,10 @@ static bool g_override_am_i_bundled_value = false;
// Adapted from http://developer.apple.com/carbon/tipsandtricks.html#AmIBundled // Adapted from http://developer.apple.com/carbon/tipsandtricks.html#AmIBundled
static bool UncachedAmIBundled() { static bool UncachedAmIBundled() {
#if defined(OS_IOS)
// All apps are bundled on iOS
return true;
#else
if (g_override_am_i_bundled) if (g_override_am_i_bundled)
return g_override_am_i_bundled_value; return g_override_am_i_bundled_value;
...@@ -47,6 +53,7 @@ static bool UncachedAmIBundled() { ...@@ -47,6 +53,7 @@ static bool UncachedAmIBundled() {
} }
return info.nodeFlags & kFSNodeIsDirectoryMask; return info.nodeFlags & kFSNodeIsDirectoryMask;
#endif
} }
bool AmIBundled() { bool AmIBundled() {
...@@ -62,6 +69,11 @@ bool AmIBundled() { ...@@ -62,6 +69,11 @@ bool AmIBundled() {
} }
void SetOverrideAmIBundled(bool value) { void SetOverrideAmIBundled(bool value) {
#if defined(OS_IOS)
// It doesn't make sense not to be bundled on iOS.
if (!value)
NOTREACHED();
#endif
g_override_am_i_bundled = true; g_override_am_i_bundled = true;
g_override_am_i_bundled_value = value; g_override_am_i_bundled_value = value;
} }
...@@ -317,8 +329,10 @@ CF_CAST_DEFN(CFNumber); ...@@ -317,8 +329,10 @@ CF_CAST_DEFN(CFNumber);
CF_CAST_DEFN(CFSet); CF_CAST_DEFN(CFSet);
CF_CAST_DEFN(CFString); CF_CAST_DEFN(CFString);
#if !defined(OS_IOS)
CF_CAST_DEFN(SecACL); CF_CAST_DEFN(SecACL);
CF_CAST_DEFN(SecTrustedApplication); CF_CAST_DEFN(SecTrustedApplication);
#endif
#undef CF_CAST_DEFN #undef CF_CAST_DEFN
......
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
#include "base/mac/mac_logging.h" #include "base/mac/mac_logging.h"
#include <CoreServices/CoreServices.h>
#include <iomanip> #include <iomanip>
#if !defined(OS_IOS)
#include <CoreServices/CoreServices.h>
#endif
namespace logging { namespace logging {
OSStatusLogMessage::OSStatusLogMessage(const char* file_path, OSStatusLogMessage::OSStatusLogMessage(const char* file_path,
...@@ -19,11 +21,17 @@ OSStatusLogMessage::OSStatusLogMessage(const char* file_path, ...@@ -19,11 +21,17 @@ OSStatusLogMessage::OSStatusLogMessage(const char* file_path,
} }
OSStatusLogMessage::~OSStatusLogMessage() { OSStatusLogMessage::~OSStatusLogMessage() {
#if defined(OS_IOS)
// TODO(ios): Consider using NSError with NSOSStatusErrorDomain to try to
// get a description of the failure.
stream() << ": " << status_;
#else
stream() << ": " stream() << ": "
<< GetMacOSStatusErrorString(status_) << GetMacOSStatusErrorString(status_)
<< " (" << " ("
<< status_ << status_
<< ")"; << ")";
#endif
} }
} // namespace logging } // namespace logging
...@@ -6,9 +6,14 @@ ...@@ -6,9 +6,14 @@
#define BASE_MAC_MAC_LOGGING_H_ #define BASE_MAC_MAC_LOGGING_H_
#pragma once #pragma once
#include <libkern/OSTypes.h>
#include "base/logging.h" #include "base/logging.h"
#include "build/build_config.h"
#if defined(OS_IOS)
#include <MacTypes.h>
#else
#include <libkern/OSTypes.h>
#endif
// Use the OSSTATUS_LOG family to log messages related to errors in Mac OS X // Use the OSSTATUS_LOG family to log messages related to errors in Mac OS X
// system routines that report status via an OSStatus or OSErr value. It is // system routines that report status via an OSStatus or OSErr value. It is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment