diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/file_version_info.h | 2 | ||||
-rw-r--r-- | base/mac/foundation_util.h | 56 | ||||
-rw-r--r-- | base/mac/mac_util.h | 54 | ||||
-rw-r--r-- | base/mac/objc_property_releaser.h | 4 | ||||
-rw-r--r-- | base/mac/os_crash_dumps.h | 6 | ||||
-rw-r--r-- | base/mac/scoped_nsautorelease_pool.h | 5 | ||||
-rw-r--r-- | base/mac/scoped_nsexception_enabler.h | 7 | ||||
-rw-r--r-- | base/mach_ipc_mac.h | 9 | ||||
-rw-r--r-- | base/process_util.h | 2 | ||||
-rw-r--r-- | base/sys_string_conversions.h | 24 |
10 files changed, 91 insertions, 78 deletions
diff --git a/base/file_version_info.h b/base/file_version_info.h index 8769a14..ab9ebe1 100644 --- a/base/file_version_info.h +++ b/base/file_version_info.h @@ -60,7 +60,7 @@ class FileVersionInfo { #else // Creates a FileVersionInfo for the current module. Returns NULL in case // of error. The returned object should be deleted when you are done with it. - static FileVersionInfo* CreateFileVersionInfoForCurrentModule(); + BASE_API static FileVersionInfo* CreateFileVersionInfoForCurrentModule(); #endif // OS_WIN // Accessors to the different version properties. diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h index dc7d4e7..37c2ff1 100644 --- a/base/mac/foundation_util.h +++ b/base/mac/foundation_util.h @@ -11,6 +11,7 @@ #include <string> #include <vector> +#include "base/base_api.h" #include "base/logging.h" #if defined(__OBJC__) @@ -35,25 +36,25 @@ namespace base { namespace mac { // Returns true if the application is running from a bundle -bool AmIBundled(); -void SetOverrideAmIBundled(bool value); +BASE_API bool AmIBundled(); +BASE_API void SetOverrideAmIBundled(bool value); // Returns true if this process is marked as a "Background only process". -bool IsBackgroundOnlyProcess(); +BASE_API bool IsBackgroundOnlyProcess(); // Returns the main bundle or the override, used for code that needs // to fetch resources from bundles, but work within a unittest where we // aren't a bundle. -NSBundle* MainAppBundle(); -FilePath MainAppBundlePath(); +BASE_API NSBundle* MainAppBundle(); +BASE_API FilePath MainAppBundlePath(); // Returns the path to a resource within the MainAppBundle. FilePath PathForMainAppBundleResource(CFStringRef resourceName); // Set the bundle that MainAppBundle will return, overriding the default value // (Restore the default by calling SetOverrideAppBundle(nil)). -void SetOverrideAppBundle(NSBundle* bundle); -void SetOverrideAppBundlePath(const FilePath& file_path); +BASE_API void SetOverrideAppBundle(NSBundle* bundle); +BASE_API void SetOverrideAppBundlePath(const FilePath& file_path); // Returns the creator code associated with the CFBundleRef at bundle. OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); @@ -64,7 +65,7 @@ OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); // does not respect the override app bundle because it's based on CFBundle // instead of NSBundle, and because callers probably don't want the override // app bundle's creator code anyway. -OSType CreatorCodeForApplication(); +BASE_API OSType CreatorCodeForApplication(); // Searches for directories for the given key in only the given |domain_mask|. // If found, fills result (which must always be non-NULL) with the @@ -76,32 +77,34 @@ bool GetSearchPathDirectory(NSSearchPathDirectory directory, // Searches for directories for the given key in only the local domain. // If found, fills result (which must always be non-NULL) with the // first found directory and returns true. Otherwise, returns false. -bool GetLocalDirectory(NSSearchPathDirectory directory, FilePath* result); +BASE_API bool GetLocalDirectory(NSSearchPathDirectory directory, + FilePath* result); // Searches for directories for the given key in only the user domain. // If found, fills result (which must always be non-NULL) with the // first found directory and returns true. Otherwise, returns false. -bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result); +BASE_API bool GetUserDirectory(NSSearchPathDirectory directory, + FilePath* result); // Returns the ~/Library directory. -FilePath GetUserLibraryPath(); +BASE_API FilePath GetUserLibraryPath(); // Takes a path to an (executable) binary and tries to provide the path to an // application bundle containing it. It takes the outermost bundle that it can // find (so for "/Foo/Bar.app/.../Baz.app/..." it produces "/Foo/Bar.app"). // |exec_name| - path to the binary // returns - path to the application bundle, or empty on error -FilePath GetAppBundlePath(const FilePath& exec_name); +BASE_API FilePath GetAppBundlePath(const FilePath& exec_name); // Utility function to pull out a value from a dictionary, check its type, and // return it. Returns NULL if the key is not present or of the wrong type. -CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, - CFStringRef key, - CFTypeID expected_type); +BASE_API CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, + CFStringRef key, + CFTypeID expected_type); // Retain/release calls for memory management in C++. -void NSObjectRetain(void* obj); -void NSObjectRelease(void* obj); +BASE_API void NSObjectRetain(void* obj); +BASE_API void NSObjectRelease(void* obj); // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation // object (one derived from CFTypeRef) to the Foundation memory management @@ -120,16 +123,16 @@ void NSObjectRelease(void* obj); // returned NSObject. // // Returns an id, typed here for C++'s sake as a void*. -void* CFTypeRefToNSObjectAutorelease(CFTypeRef cf_object); +BASE_API void* CFTypeRefToNSObjectAutorelease(CFTypeRef cf_object); // Returns the base bundle ID, which can be set by SetBaseBundleID but // defaults to a reasonable string. This never returns NULL. BaseBundleID // returns a pointer to static storage that must not be freed. -const char* BaseBundleID(); +BASE_API const char* BaseBundleID(); // Sets the base bundle ID to override the default. The implementation will // make its own copy of new_base_bundle_id. -void SetBaseBundleID(const char* new_base_bundle_id); +BASE_API void SetBaseBundleID(const char* new_base_bundle_id); } // namespace mac } // namespace base @@ -158,8 +161,8 @@ OBJC_CPP_CLASS_DECL(TypeNS) \ \ namespace base { \ namespace mac { \ -TypeNS* CFToNSCast(TypeCF##Ref cf_val); \ -TypeCF##Ref NSToCFCast(TypeNS* ns_val); \ +BASE_API TypeNS* CFToNSCast(TypeCF##Ref cf_val); \ +BASE_API TypeCF##Ref NSToCFCast(TypeNS* ns_val); \ } \ } \ @@ -169,8 +172,8 @@ OBJC_CPP_CLASS_DECL(NSMutable##name) \ \ namespace base { \ namespace mac { \ -NSMutable##name* CFToNSCast(CFMutable##name##Ref cf_val); \ -CFMutable##name##Ref NSToCFCast(NSMutable##name* ns_val); \ +BASE_API NSMutable##name* CFToNSCast(CFMutable##name##Ref cf_val); \ +BASE_API CFMutable##name##Ref NSToCFCast(NSMutable##name* ns_val); \ } \ } \ @@ -200,7 +203,8 @@ CF_TO_NS_CAST_DECL(CFURL, NSURL); // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); // Operator << can not be overloaded for ObjectiveC types as the compiler // can not distinguish between overloads for id with overloads for void*. -extern std::ostream& operator<<(std::ostream& o, const CFErrorRef err); -extern std::ostream& operator<<(std::ostream& o, const CFStringRef str); +BASE_API extern std::ostream& operator<<(std::ostream& o, const CFErrorRef err); +BASE_API extern std::ostream& operator<<(std::ostream& o, + const CFStringRef str); #endif // BASE_MAC_FOUNDATION_UTIL_H_ diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h index 71d3a6f..67151a7 100644 --- a/base/mac/mac_util.h +++ b/base/mac/mac_util.h @@ -10,6 +10,7 @@ #include <Carbon/Carbon.h> #include <string> +#include "base/base_api.h" #include "base/logging.h" // TODO(rohitrao): Clean up sites that include mac_util.h and remove this line. @@ -39,22 +40,22 @@ enum FullScreenMode { kFullScreenModeNormal = 10, }; -std::string PathFromFSRef(const FSRef& ref); -bool FSRefFromPath(const std::string& path, FSRef* ref); +BASE_API std::string PathFromFSRef(const FSRef& ref); +BASE_API bool FSRefFromPath(const std::string& path, FSRef* ref); // Returns an sRGB color space. The return value is a static value; do not // release it! -CGColorSpaceRef GetSRGBColorSpace(); +BASE_API CGColorSpaceRef GetSRGBColorSpace(); // Returns the color space being used by the main display. The return value // is a static value; do not release it! -CGColorSpaceRef GetSystemColorSpace(); +BASE_API CGColorSpaceRef GetSystemColorSpace(); // Add a full screen request for the given |mode|. Must be paired with a // ReleaseFullScreen() call for the same |mode|. This does not by itself create // a fullscreen window; rather, it manages per-application state related to // hiding the dock and menubar. Must be called on the main thread. -void RequestFullScreen(FullScreenMode mode); +BASE_API void RequestFullScreen(FullScreenMode mode); // Release a request for full screen mode. Must be matched with a // RequestFullScreen() call for the same |mode|. As with RequestFullScreen(), @@ -62,44 +63,45 @@ void RequestFullScreen(FullScreenMode mode); // state. For example, if there are no other outstanding // |kFullScreenModeAutoHideAll| requests, this will reshow the menu bar. Must // be called on main thread. -void ReleaseFullScreen(FullScreenMode mode); +BASE_API void ReleaseFullScreen(FullScreenMode mode); // Convenience method to switch the current fullscreen mode. This has the same // net effect as a ReleaseFullScreen(from_mode) call followed immediately by a // RequestFullScreen(to_mode). Must be called on the main thread. -void SwitchFullScreenModes(FullScreenMode from_mode, FullScreenMode to_mode); +BASE_API void SwitchFullScreenModes(FullScreenMode from_mode, + FullScreenMode to_mode); // Set the visibility of the cursor. -void SetCursorVisibility(bool visible); +BASE_API void SetCursorVisibility(bool visible); // Should windows miniaturize on a double-click (on the title bar)? -bool ShouldWindowsMiniaturizeOnDoubleClick(); +BASE_API bool ShouldWindowsMiniaturizeOnDoubleClick(); // Activates the process with the given PID. -void ActivateProcess(pid_t pid); +BASE_API void ActivateProcess(pid_t pid); // Returns true if this process is in the foreground, meaning that it's the // frontmost process, the one whose menu bar is shown at the top of the main // display. -bool AmIForeground(); +BASE_API bool AmIForeground(); // Excludes the file given by |file_path| from being backed up by Time Machine. -bool SetFileBackupExclusion(const FilePath& file_path); +BASE_API bool SetFileBackupExclusion(const FilePath& file_path); // Sets the process name as displayed in Activity Monitor to process_name. -void SetProcessName(CFStringRef process_name); +BASE_API void SetProcessName(CFStringRef process_name); // Converts a NSImage to a CGImageRef. Normally, the system frameworks can do // this fine, especially on 10.6. On 10.5, however, CGImage cannot handle // converting a PDF-backed NSImage into a CGImageRef. This function will // rasterize the PDF into a bitmap CGImage. The caller is responsible for // releasing the return value. -CGImageRef CopyNSImageToCGImage(NSImage* image); +BASE_API CGImageRef CopyNSImageToCGImage(NSImage* image); // Checks if the current application is set as a Login Item, so it will launch // on Login. If a non-NULL pointer to is_hidden is passed, the Login Item also // is queried for the 'hide on launch' flag. -bool CheckLoginItemStatus(bool* is_hidden); +BASE_API bool CheckLoginItemStatus(bool* is_hidden); // Adds current application to the set of Login Items with specified "hide" // flag. This has the same effect as adding/removing the application in @@ -107,14 +109,14 @@ bool CheckLoginItemStatus(bool* is_hidden); // as "Options->Open on Login". // Does nothing if the application is already set up as Login Item with // specified hide flag. -void AddToLoginItems(bool hide_on_startup); +BASE_API void AddToLoginItems(bool hide_on_startup); // Removes the current application from the list Of Login Items. -void RemoveFromLoginItems(); +BASE_API void RemoveFromLoginItems(); // Returns true if the current process was automatically launched as a // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows. -bool WasLaunchedAsHiddenLoginItem(); +BASE_API bool WasLaunchedAsHiddenLoginItem(); // Run-time OS version checks. Use these instead of // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and @@ -122,22 +124,22 @@ bool WasLaunchedAsHiddenLoginItem(); // know for sure that you need to check for a specific version. // Leopard is Mac OS X 10.5, Darwin 9. -bool IsOSLeopard(); -bool IsOSLeopardOrEarlier(); +BASE_API bool IsOSLeopard(); +BASE_API bool IsOSLeopardOrEarlier(); // Snow Leopard is Mac OS X 10.6, Darwin 10. -bool IsOSSnowLeopard(); -bool IsOSSnowLeopardOrEarlier(); -bool IsOSSnowLeopardOrLater(); +BASE_API bool IsOSSnowLeopard(); +BASE_API bool IsOSSnowLeopardOrEarlier(); +BASE_API bool IsOSSnowLeopardOrLater(); // Lion is Mac OS X 10.7, Darwin 11. -bool IsOSLion(); -bool IsOSLionOrLater(); +BASE_API bool IsOSLion(); +BASE_API bool IsOSLionOrLater(); // This should be infrequently used. It only makes sense to use this to avoid // codepaths that are very likely to break on future (unreleased, untested, // unborn) OS releases. -bool IsOSLaterThanLion(); +BASE_API bool IsOSLaterThanLion(); // When the deployment target is set, the code produced cannot run on earlier // OS releases. That enables some of the IsOS* family to be implemented as diff --git a/base/mac/objc_property_releaser.h b/base/mac/objc_property_releaser.h index 1aee6b3..58c9b66 100644 --- a/base/mac/objc_property_releaser.h +++ b/base/mac/objc_property_releaser.h @@ -8,6 +8,8 @@ #import <Foundation/Foundation.h> +#include "base/base_api.h" + namespace base { namespace mac { @@ -81,7 +83,7 @@ namespace mac { // will only operate on instance variables in the immediate object in which // the property releaser is placed. -class ObjCPropertyReleaser { +class BASE_API ObjCPropertyReleaser { public: // ObjCPropertyReleaser can only be owned by an Objective-C object, so its // memory is always guaranteed to be 0-initialized. Not defining the default diff --git a/base/mac/os_crash_dumps.h b/base/mac/os_crash_dumps.h index 9758575..6e74365 100644 --- a/base/mac/os_crash_dumps.h +++ b/base/mac/os_crash_dumps.h @@ -1,10 +1,12 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_MAC_OS_CRASH_DUMPS_H_ #define BASE_MAC_OS_CRASH_DUMPS_H_ +#include "base/base_api.h" + namespace base { namespace mac { @@ -12,7 +14,7 @@ namespace mac { // process a Chrome crash when debugging symbols are available. This // translates into a long wait until the process actually dies. This call // disables Apple Crash Reporter entirely. -void DisableOSCrashDumps(); +BASE_API void DisableOSCrashDumps(); } // namespace mac } // namespace base diff --git a/base/mac/scoped_nsautorelease_pool.h b/base/mac/scoped_nsautorelease_pool.h index 0a95bd1b..297b10a 100644 --- a/base/mac/scoped_nsautorelease_pool.h +++ b/base/mac/scoped_nsautorelease_pool.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #define BASE_MAC_SCOPED_NSAUTORELEASE_POOL_H_ #pragma once +#include "base/base_api.h" #include "base/basictypes.h" #if defined(OS_MACOSX) @@ -27,7 +28,7 @@ namespace mac { // On other platforms, ScopedNSAutoreleasePool is an empty object with no // effects. This allows it to be used directly in cross-platform code without // ugly #ifdefs. -class ScopedNSAutoreleasePool { +class BASE_API ScopedNSAutoreleasePool { public: #if !defined(OS_MACOSX) ScopedNSAutoreleasePool() {} diff --git a/base/mac/scoped_nsexception_enabler.h b/base/mac/scoped_nsexception_enabler.h index a10120b..a251fcc 100644 --- a/base/mac/scoped_nsexception_enabler.h +++ b/base/mac/scoped_nsexception_enabler.h @@ -6,6 +6,7 @@ #define BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ #pragma once +#include "base/base_api.h" #include "base/basictypes.h" namespace base { @@ -23,7 +24,7 @@ namespace mac { // top-level event loop, things are cleared in -reportException:. If // the exception is caught at a lower level, a higher level scoper // should eventually reset things. -class ScopedNSExceptionEnabler { +class BASE_API ScopedNSExceptionEnabler { public: ScopedNSExceptionEnabler(); ~ScopedNSExceptionEnabler(); @@ -37,8 +38,8 @@ class ScopedNSExceptionEnabler { // Access the exception setting for the current thread. This is for // the support code in BrowserCrApplication, other code should use // the scoper. -bool GetNSExceptionsAllowed(); -void SetNSExceptionsAllowed(bool allowed); +BASE_API bool GetNSExceptionsAllowed(); +BASE_API void SetNSExceptionsAllowed(bool allowed); } // namespace mac } // namespace base diff --git a/base/mach_ipc_mac.h b/base/mach_ipc_mac.h index 4e80f62..2ae7084 100644 --- a/base/mach_ipc_mac.h +++ b/base/mach_ipc_mac.h @@ -13,6 +13,7 @@ #include <CoreServices/CoreServices.h> +#include "base/base_api.h" #include "base/basictypes.h" //============================================================================== @@ -138,7 +139,7 @@ class MachMsgPortDescriptor : public mach_msg_port_descriptor_t { // A MachMessage object is used by ReceivePort::WaitForMessage // and MachPortSender::SendMessage // -class MachMessage { +class BASE_API MachMessage { public: static const size_t kEmptyMessageSize; @@ -244,7 +245,7 @@ class MachReceiveMessage : public MachMessage { }; //============================================================================== -class MachSendMessage : public MachMessage { +class BASE_API MachSendMessage : public MachMessage { public: explicit MachSendMessage(int32_t message_id); MachSendMessage(void *storage, size_t storage_length, int32_t message_id); @@ -257,7 +258,7 @@ class MachSendMessage : public MachMessage { //============================================================================== // Represents a Mach port for which we have receive rights -class ReceivePort { +class BASE_API ReceivePort { public: // Creates a new Mach port for receiving messages and registers a name for it explicit ReceivePort(const char *receive_port_name); @@ -288,7 +289,7 @@ class ReceivePort { //============================================================================== // Represents a Mach port for which we have send rights -class MachPortSender { +class BASE_API MachPortSender { public: // get a port with send rights corresponding to a named registered service explicit MachPortSender(const char *receive_port_name); diff --git a/base/process_util.h b/base/process_util.h index 2179b61..3d9b7d1 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -675,7 +675,7 @@ BASE_API void EnableTerminationOnHeapCorruption(); BASE_API void EnableTerminationOnOutOfMemory(); #if defined(OS_MACOSX) // Exposed for testing. -malloc_zone_t* GetPurgeableZone(); +BASE_API malloc_zone_t* GetPurgeableZone(); #endif #endif diff --git a/base/sys_string_conversions.h b/base/sys_string_conversions.h index 4cf4b7a..fefc2fa 100644 --- a/base/sys_string_conversions.h +++ b/base/sys_string_conversions.h @@ -62,25 +62,25 @@ BASE_API std::string SysWideToMultiByte(const std::wstring& wide, // Creates a string, and returns it with a refcount of 1. You are responsible // for releasing it. Returns NULL on failure. -CFStringRef SysUTF8ToCFStringRef(const std::string& utf8); -CFStringRef SysUTF16ToCFStringRef(const string16& utf16); -CFStringRef SysWideToCFStringRef(const std::wstring& wide); +BASE_API CFStringRef SysUTF8ToCFStringRef(const std::string& utf8); +BASE_API CFStringRef SysUTF16ToCFStringRef(const string16& utf16); +BASE_API CFStringRef SysWideToCFStringRef(const std::wstring& wide); // Same, but returns an autoreleased NSString. -NSString* SysUTF8ToNSString(const std::string& utf8); -NSString* SysUTF16ToNSString(const string16& utf16); -NSString* SysWideToNSString(const std::wstring& wide); +BASE_API NSString* SysUTF8ToNSString(const std::string& utf8); +BASE_API NSString* SysUTF16ToNSString(const string16& utf16); +BASE_API NSString* SysWideToNSString(const std::wstring& wide); // Converts a CFStringRef to an STL string. Returns an empty string on failure. -std::string SysCFStringRefToUTF8(CFStringRef ref); -string16 SysCFStringRefToUTF16(CFStringRef ref); -std::wstring SysCFStringRefToWide(CFStringRef ref); +BASE_API std::string SysCFStringRefToUTF8(CFStringRef ref); +BASE_API string16 SysCFStringRefToUTF16(CFStringRef ref); +BASE_API std::wstring SysCFStringRefToWide(CFStringRef ref); // Same, but accepts NSString input. Converts nil NSString* to the appropriate // string type of length 0. -std::string SysNSStringToUTF8(NSString* ref); -string16 SysNSStringToUTF16(NSString* ref); -std::wstring SysNSStringToWide(NSString* ref); +BASE_API std::string SysNSStringToUTF8(NSString* ref); +BASE_API string16 SysNSStringToUTF16(NSString* ref); +BASE_API std::wstring SysNSStringToWide(NSString* ref); #endif // defined(OS_MACOSX) |