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

Side by Side Diff: base/mac/mac_util.h

Issue 7461141: Rename BASE_API to BASE_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « base/mac/foundation_util.h ('k') | base/mac/objc_property_releaser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_MAC_MAC_UTIL_H_ 5 #ifndef BASE_MAC_MAC_UTIL_H_
6 #define BASE_MAC_MAC_UTIL_H_ 6 #define BASE_MAC_MAC_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <AvailabilityMacros.h> 9 #include <AvailabilityMacros.h>
10 #include <Carbon/Carbon.h> 10 #include <Carbon/Carbon.h>
11 #include <string> 11 #include <string>
12 12
13 #include "base/base_api.h" 13 #include "base/base_export.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 15
16 // TODO(rohitrao): Clean up sites that include mac_util.h and remove this line. 16 // TODO(rohitrao): Clean up sites that include mac_util.h and remove this line.
17 #include "base/mac/foundation_util.h" 17 #include "base/mac/foundation_util.h"
18 18
19 #if defined(__OBJC__) 19 #if defined(__OBJC__)
20 #import <Foundation/Foundation.h> 20 #import <Foundation/Foundation.h>
21 #else // __OBJC__ 21 #else // __OBJC__
22 class NSImage; 22 class NSImage;
23 #endif // __OBJC__ 23 #endif // __OBJC__
24 24
25 class FilePath; 25 class FilePath;
26 26
27 namespace base { 27 namespace base {
28 namespace mac { 28 namespace mac {
29 29
30 // Full screen modes, in increasing order of priority. More permissive modes 30 // Full screen modes, in increasing order of priority. More permissive modes
31 // take predecence. 31 // take predecence.
32 enum FullScreenMode { 32 enum FullScreenMode {
33 kFullScreenModeHideAll = 0, 33 kFullScreenModeHideAll = 0,
34 kFullScreenModeHideDock = 1, 34 kFullScreenModeHideDock = 1,
35 kFullScreenModeAutoHideAll = 2, 35 kFullScreenModeAutoHideAll = 2,
36 kNumFullScreenModes = 3, 36 kNumFullScreenModes = 3,
37 37
38 // kFullScreenModeNormal is not a valid FullScreenMode, but it is useful to 38 // kFullScreenModeNormal is not a valid FullScreenMode, but it is useful to
39 // other classes, so we include it here. 39 // other classes, so we include it here.
40 kFullScreenModeNormal = 10, 40 kFullScreenModeNormal = 10,
41 }; 41 };
42 42
43 BASE_API std::string PathFromFSRef(const FSRef& ref); 43 BASE_EXPORT std::string PathFromFSRef(const FSRef& ref);
44 BASE_API bool FSRefFromPath(const std::string& path, FSRef* ref); 44 BASE_EXPORT bool FSRefFromPath(const std::string& path, FSRef* ref);
45 45
46 // Returns an sRGB color space. The return value is a static value; do not 46 // Returns an sRGB color space. The return value is a static value; do not
47 // release it! 47 // release it!
48 BASE_API CGColorSpaceRef GetSRGBColorSpace(); 48 BASE_EXPORT CGColorSpaceRef GetSRGBColorSpace();
49 49
50 // Returns the color space being used by the main display. The return value 50 // Returns the color space being used by the main display. The return value
51 // is a static value; do not release it! 51 // is a static value; do not release it!
52 BASE_API CGColorSpaceRef GetSystemColorSpace(); 52 BASE_EXPORT CGColorSpaceRef GetSystemColorSpace();
53 53
54 // Add a full screen request for the given |mode|. Must be paired with a 54 // Add a full screen request for the given |mode|. Must be paired with a
55 // ReleaseFullScreen() call for the same |mode|. This does not by itself create 55 // ReleaseFullScreen() call for the same |mode|. This does not by itself create
56 // a fullscreen window; rather, it manages per-application state related to 56 // a fullscreen window; rather, it manages per-application state related to
57 // hiding the dock and menubar. Must be called on the main thread. 57 // hiding the dock and menubar. Must be called on the main thread.
58 BASE_API void RequestFullScreen(FullScreenMode mode); 58 BASE_EXPORT void RequestFullScreen(FullScreenMode mode);
59 59
60 // Release a request for full screen mode. Must be matched with a 60 // Release a request for full screen mode. Must be matched with a
61 // RequestFullScreen() call for the same |mode|. As with RequestFullScreen(), 61 // RequestFullScreen() call for the same |mode|. As with RequestFullScreen(),
62 // this does not affect windows directly, but rather manages per-application 62 // this does not affect windows directly, but rather manages per-application
63 // state. For example, if there are no other outstanding 63 // state. For example, if there are no other outstanding
64 // |kFullScreenModeAutoHideAll| requests, this will reshow the menu bar. Must 64 // |kFullScreenModeAutoHideAll| requests, this will reshow the menu bar. Must
65 // be called on main thread. 65 // be called on main thread.
66 BASE_API void ReleaseFullScreen(FullScreenMode mode); 66 BASE_EXPORT void ReleaseFullScreen(FullScreenMode mode);
67 67
68 // Convenience method to switch the current fullscreen mode. This has the same 68 // Convenience method to switch the current fullscreen mode. This has the same
69 // net effect as a ReleaseFullScreen(from_mode) call followed immediately by a 69 // net effect as a ReleaseFullScreen(from_mode) call followed immediately by a
70 // RequestFullScreen(to_mode). Must be called on the main thread. 70 // RequestFullScreen(to_mode). Must be called on the main thread.
71 BASE_API void SwitchFullScreenModes(FullScreenMode from_mode, 71 BASE_EXPORT void SwitchFullScreenModes(FullScreenMode from_mode,
72 FullScreenMode to_mode); 72 FullScreenMode to_mode);
73 73
74 // Set the visibility of the cursor. 74 // Set the visibility of the cursor.
75 BASE_API void SetCursorVisibility(bool visible); 75 BASE_EXPORT void SetCursorVisibility(bool visible);
76 76
77 // Should windows miniaturize on a double-click (on the title bar)? 77 // Should windows miniaturize on a double-click (on the title bar)?
78 BASE_API bool ShouldWindowsMiniaturizeOnDoubleClick(); 78 BASE_EXPORT bool ShouldWindowsMiniaturizeOnDoubleClick();
79 79
80 // Activates the process with the given PID. 80 // Activates the process with the given PID.
81 BASE_API void ActivateProcess(pid_t pid); 81 BASE_EXPORT void ActivateProcess(pid_t pid);
82 82
83 // Returns true if this process is in the foreground, meaning that it's the 83 // Returns true if this process is in the foreground, meaning that it's the
84 // frontmost process, the one whose menu bar is shown at the top of the main 84 // frontmost process, the one whose menu bar is shown at the top of the main
85 // display. 85 // display.
86 BASE_API bool AmIForeground(); 86 BASE_EXPORT bool AmIForeground();
87 87
88 // Excludes the file given by |file_path| from being backed up by Time Machine. 88 // Excludes the file given by |file_path| from being backed up by Time Machine.
89 BASE_API bool SetFileBackupExclusion(const FilePath& file_path); 89 BASE_EXPORT bool SetFileBackupExclusion(const FilePath& file_path);
90 90
91 // Sets the process name as displayed in Activity Monitor to process_name. 91 // Sets the process name as displayed in Activity Monitor to process_name.
92 BASE_API void SetProcessName(CFStringRef process_name); 92 BASE_EXPORT void SetProcessName(CFStringRef process_name);
93 93
94 // Converts a NSImage to a CGImageRef. Normally, the system frameworks can do 94 // Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
95 // this fine, especially on 10.6. On 10.5, however, CGImage cannot handle 95 // this fine, especially on 10.6. On 10.5, however, CGImage cannot handle
96 // converting a PDF-backed NSImage into a CGImageRef. This function will 96 // converting a PDF-backed NSImage into a CGImageRef. This function will
97 // rasterize the PDF into a bitmap CGImage. The caller is responsible for 97 // rasterize the PDF into a bitmap CGImage. The caller is responsible for
98 // releasing the return value. 98 // releasing the return value.
99 BASE_API CGImageRef CopyNSImageToCGImage(NSImage* image); 99 BASE_EXPORT CGImageRef CopyNSImageToCGImage(NSImage* image);
100 100
101 // Checks if the current application is set as a Login Item, so it will launch 101 // Checks if the current application is set as a Login Item, so it will launch
102 // on Login. If a non-NULL pointer to is_hidden is passed, the Login Item also 102 // on Login. If a non-NULL pointer to is_hidden is passed, the Login Item also
103 // is queried for the 'hide on launch' flag. 103 // is queried for the 'hide on launch' flag.
104 BASE_API bool CheckLoginItemStatus(bool* is_hidden); 104 BASE_EXPORT bool CheckLoginItemStatus(bool* is_hidden);
105 105
106 // Adds current application to the set of Login Items with specified "hide" 106 // Adds current application to the set of Login Items with specified "hide"
107 // flag. This has the same effect as adding/removing the application in 107 // flag. This has the same effect as adding/removing the application in
108 // SystemPreferences->Accounts->LoginItems or marking Application in the Dock 108 // SystemPreferences->Accounts->LoginItems or marking Application in the Dock
109 // as "Options->Open on Login". 109 // as "Options->Open on Login".
110 // Does nothing if the application is already set up as Login Item with 110 // Does nothing if the application is already set up as Login Item with
111 // specified hide flag. 111 // specified hide flag.
112 BASE_API void AddToLoginItems(bool hide_on_startup); 112 BASE_EXPORT void AddToLoginItems(bool hide_on_startup);
113 113
114 // Removes the current application from the list Of Login Items. 114 // Removes the current application from the list Of Login Items.
115 BASE_API void RemoveFromLoginItems(); 115 BASE_EXPORT void RemoveFromLoginItems();
116 116
117 // Returns true if the current process was automatically launched as a 117 // Returns true if the current process was automatically launched as a
118 // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows. 118 // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows.
119 BASE_API bool WasLaunchedAsHiddenLoginItem(); 119 BASE_EXPORT bool WasLaunchedAsHiddenLoginItem();
120 120
121 // Run-time OS version checks. Use these instead of 121 // Run-time OS version checks. Use these instead of
122 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and 122 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and
123 // "OrLater" variants to those that check for a specific version, unless you 123 // "OrLater" variants to those that check for a specific version, unless you
124 // know for sure that you need to check for a specific version. 124 // know for sure that you need to check for a specific version.
125 125
126 // Leopard is Mac OS X 10.5, Darwin 9. 126 // Leopard is Mac OS X 10.5, Darwin 9.
127 BASE_API bool IsOSLeopard(); 127 BASE_EXPORT bool IsOSLeopard();
128 BASE_API bool IsOSLeopardOrEarlier(); 128 BASE_EXPORT bool IsOSLeopardOrEarlier();
129 129
130 // Snow Leopard is Mac OS X 10.6, Darwin 10. 130 // Snow Leopard is Mac OS X 10.6, Darwin 10.
131 BASE_API bool IsOSSnowLeopard(); 131 BASE_EXPORT bool IsOSSnowLeopard();
132 BASE_API bool IsOSSnowLeopardOrEarlier(); 132 BASE_EXPORT bool IsOSSnowLeopardOrEarlier();
133 BASE_API bool IsOSSnowLeopardOrLater(); 133 BASE_EXPORT bool IsOSSnowLeopardOrLater();
134 134
135 // Lion is Mac OS X 10.7, Darwin 11. 135 // Lion is Mac OS X 10.7, Darwin 11.
136 BASE_API bool IsOSLion(); 136 BASE_EXPORT bool IsOSLion();
137 BASE_API bool IsOSLionOrLater(); 137 BASE_EXPORT bool IsOSLionOrLater();
138 138
139 // This should be infrequently used. It only makes sense to use this to avoid 139 // This should be infrequently used. It only makes sense to use this to avoid
140 // codepaths that are very likely to break on future (unreleased, untested, 140 // codepaths that are very likely to break on future (unreleased, untested,
141 // unborn) OS releases. 141 // unborn) OS releases.
142 BASE_API bool IsOSLaterThanLion(); 142 BASE_EXPORT bool IsOSLaterThanLion();
143 143
144 // When the deployment target is set, the code produced cannot run on earlier 144 // When the deployment target is set, the code produced cannot run on earlier
145 // OS releases. That enables some of the IsOS* family to be implemented as 145 // OS releases. That enables some of the IsOS* family to be implemented as
146 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro 146 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro
147 // contains the value of the deployment target. 147 // contains the value of the deployment target.
148 148
149 #if defined(MAC_OS_X_VERSION_10_6) && \ 149 #if defined(MAC_OS_X_VERSION_10_6) && \
150 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 150 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
151 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6 151 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6
152 inline bool IsOSLeopard() { return false; } 152 inline bool IsOSLeopard() { return false; }
(...skipping 13 matching lines...) Expand all
166 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 166 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7
167 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 167 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7
168 inline bool IsOSLion() { return false; } 168 inline bool IsOSLion() { return false; }
169 inline bool IsOSLaterThanLion() { return true; } 169 inline bool IsOSLaterThanLion() { return true; }
170 #endif 170 #endif
171 171
172 } // namespace mac 172 } // namespace mac
173 } // namespace base 173 } // namespace base
174 174
175 #endif // BASE_MAC_MAC_UTIL_H_ 175 #endif // BASE_MAC_MAC_UTIL_H_
OLDNEW
« no previous file with comments | « base/mac/foundation_util.h ('k') | base/mac/objc_property_releaser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698