summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-01 18:20:14 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-01 18:20:14 +0000
commit0378bf4edc40686bac06c8e14bd25fdb3f9cfb28 (patch)
treeee5543b43dd9743d75e1aa8f16692dcfca6c813f /base
parentd028296ec1c0fdfbd40e2390ca3121de7055295d (diff)
downloadchromium_src-0378bf4edc40686bac06c8e14bd25fdb3f9cfb28.zip
chromium_src-0378bf4edc40686bac06c8e14bd25fdb3f9cfb28.tar.gz
chromium_src-0378bf4edc40686bac06c8e14bd25fdb3f9cfb28.tar.bz2
Move base/mac_util.h to base/mac and use the base::mac namespace.
Fix up callers to use the new location & namespace. Remove includes from  files where it wasn't necessary. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/6046009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gyp2
-rw-r--r--base/base.gypi4
-rw-r--r--base/base_paths_mac.mm8
-rw-r--r--base/file_version_info_mac.mm6
-rw-r--r--base/mac/mac_util.h (renamed from base/mac_util.h)12
-rw-r--r--base/mac/mac_util.mm (renamed from base/mac_util.mm)30
-rw-r--r--base/mac/mac_util_unittest.mm (renamed from base/mac_util_unittest.mm)17
7 files changed, 41 insertions, 38 deletions
diff --git a/base/base.gyp b/base/base.gyp
index 97cb3e0..6e62c84 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -99,7 +99,7 @@
'linked_ptr_unittest.cc',
'lock_unittest.cc',
'logging_unittest.cc',
- 'mac_util_unittest.mm',
+ 'mac/mac_util_unittest.mm',
'message_loop_proxy_impl_unittest.cc',
'message_loop_unittest.cc',
'message_pump_glib_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index bbb25fc..ee794fd 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -111,9 +111,9 @@
'logging.cc',
'logging.h',
'logging_win.cc',
- 'mac_util.h',
- 'mac_util.mm',
'mac/cocoa_protocols.h',
+ 'mac/mac_util.h',
+ 'mac/mac_util.mm',
'mac/os_crash_dumps.cc',
'mac/os_crash_dumps.h',
'mac/scoped_aedesc.h',
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm
index 97413ba..1210834 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -11,7 +11,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -48,15 +48,15 @@ bool PathProviderMac(int key, FilePath* result) {
return GetNSExecutablePath(result);
}
case base::DIR_CACHE:
- return mac_util::GetUserDirectory(NSCachesDirectory, result);
+ return base::mac::GetUserDirectory(NSCachesDirectory, result);
case base::DIR_APP_DATA:
- return mac_util::GetUserDirectory(NSApplicationSupportDirectory, result);
+ return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
case base::DIR_SOURCE_ROOT: {
// Go through PathService to catch overrides.
if (PathService::Get(base::FILE_EXE, result)) {
// Start with the executable's directory.
*result = result->DirName();
- if (mac_util::AmIBundled()) {
+ if (base::mac::AmIBundled()) {
// The bundled app executables (Chromium, TestShell, etc) live five
// levels down, eg:
// src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium
diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm
index fa97df8..f716ccc 100644
--- a/base/file_version_info_mac.mm
+++ b/base/file_version_info_mac.mm
@@ -8,15 +8,15 @@
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
-#include "base/mac_util.h"
FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) {
}
// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
- return CreateFileVersionInfo(mac_util::MainAppBundlePath());
+ return CreateFileVersionInfo(base::mac::MainAppBundlePath());
}
// static
@@ -97,7 +97,7 @@ bool FileVersionInfoMac::is_official_build() {
string16 FileVersionInfoMac::GetString16Value(CFStringRef name) {
if (bundle_) {
- NSString *ns_name = mac_util::CFToNSCast(name);
+ NSString *ns_name = base::mac::CFToNSCast(name);
NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name];
if (value) {
return base::SysNSStringToUTF16(value);
diff --git a/base/mac_util.h b/base/mac/mac_util.h
index 076865d..7e5dddb 100644
--- a/base/mac_util.h
+++ b/base/mac/mac_util.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_MAC_UTIL_H_
-#define BASE_MAC_UTIL_H_
+#ifndef BASE_MAC_MAC_UTIL_H_
+#define BASE_MAC_MAC_UTIL_H_
#pragma once
#include <Carbon/Carbon.h>
@@ -34,7 +34,8 @@ typedef unsigned int NSSearchPathDirectory;
typedef unsigned int NSSearchPathDomainMask;
#endif
-namespace mac_util {
+namespace base {
+namespace mac {
// Full screen modes, in increasing order of priority. More permissive modes
// take predecence.
@@ -242,6 +243,7 @@ CF_TO_NS_CAST(CFWriteStreamRef, NSOutputStream);
#endif // __OBJC__
-} // namespace mac_util
+} // namespace mac
+} // namespace base
-#endif // BASE_MAC_UTIL_H_
+#endif // BASE_MAC_MAC_UTIL_H_
diff --git a/base/mac_util.mm b/base/mac/mac_util.mm
index 598f69b..21213ba 100644
--- a/base/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import <Cocoa/Cocoa.h>
@@ -13,13 +13,14 @@
#include "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
-using base::mac::ScopedCFTypeRef;
+namespace base {
+namespace mac {
namespace {
// a count of currently outstanding requests for full screen mode from browser
// windows, plugins, etc.
-int g_full_screen_requests[mac_util::kNumFullScreenModes] = { 0, 0, 0};
+int g_full_screen_requests[kNumFullScreenModes] = { 0, 0, 0};
// Sets the appropriate SystemUIMode based on the current full screen requests.
// Since only one SystemUIMode can be active at a given time, full screen
@@ -39,12 +40,12 @@ void SetUIMode() {
// HideDock.
SystemUIMode desired_mode = kUIModeNormal;
SystemUIOptions desired_options = 0;
- if (g_full_screen_requests[mac_util::kFullScreenModeAutoHideAll] > 0) {
+ if (g_full_screen_requests[kFullScreenModeAutoHideAll] > 0) {
desired_mode = kUIModeAllHidden;
desired_options = kUIOptionAutoShowMenuBar;
- } else if (g_full_screen_requests[mac_util::kFullScreenModeHideDock] > 0) {
+ } else if (g_full_screen_requests[kFullScreenModeHideDock] > 0) {
desired_mode = kUIModeContentHidden;
- } else if (g_full_screen_requests[mac_util::kFullScreenModeHideAll] > 0) {
+ } else if (g_full_screen_requests[kFullScreenModeHideAll] > 0) {
desired_mode = kUIModeAllHidden;
}
@@ -56,16 +57,16 @@ bool WasLaunchedAsLoginItem() {
ProcessSerialNumber psn = { 0, kCurrentProcess };
scoped_nsobject<NSDictionary> process_info(
- mac_util::CFToNSCast(ProcessInformationCopyDictionary(&psn,
- kProcessDictionaryIncludeAllInformationMask)));
+ CFToNSCast(ProcessInformationCopyDictionary(&psn,
+ kProcessDictionaryIncludeAllInformationMask)));
long long temp = [[process_info objectForKey:@"ParentPSN"] longLongValue];
ProcessSerialNumber parent_psn =
{ (temp >> 32) & 0x00000000FFFFFFFFLL, temp & 0x00000000FFFFFFFFLL };
scoped_nsobject<NSDictionary> parent_info(
- mac_util::CFToNSCast(ProcessInformationCopyDictionary(&parent_psn,
- kProcessDictionaryIncludeAllInformationMask)));
+ CFToNSCast(ProcessInformationCopyDictionary(&parent_psn,
+ kProcessDictionaryIncludeAllInformationMask)));
// Check that creator process code is that of loginwindow.
BOOL result =
@@ -87,7 +88,7 @@ LSSharedFileListItemRef GetLoginItemForApp() {
}
scoped_nsobject<NSArray> login_items_array(
- mac_util::CFToNSCast(LSSharedFileListCopySnapshot(login_items, NULL)));
+ CFToNSCast(LSSharedFileListCopySnapshot(login_items, NULL)));
NSURL* url = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
@@ -125,9 +126,7 @@ bool IsHiddenLoginItem(LSSharedFileListItemRef item) {
return hidden && hidden == kCFBooleanTrue;
}
-} // end namespace
-
-namespace mac_util {
+} // namespace
std::string PathFromFSRef(const FSRef& ref) {
ScopedCFTypeRef<CFURLRef> url(
@@ -713,4 +712,5 @@ void NSObjectRelease(void* obj) {
[nsobj release];
}
-} // namespace mac_util
+} // namespace mac
+} // namespace base
diff --git a/base/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index 63ea9b2..47ecebf 100644
--- a/base/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -5,7 +5,7 @@
#import <Cocoa/Cocoa.h>
#include <vector>
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -16,7 +16,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-namespace mac_util {
+namespace base {
+namespace mac {
namespace {
@@ -151,7 +152,7 @@ TEST_F(MacUtilTest, TestExcludeFileFromBackups) {
}
TEST_F(MacUtilTest, TestGetValueFromDictionary) {
- base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> dict(
+ ScopedCFTypeRef<CFMutableDictionaryRef> dict(
CFDictionaryCreateMutable(0, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
@@ -175,8 +176,7 @@ TEST_F(MacUtilTest, CopyNSImageToCGImage) {
NSRectFill(rect);
[nsImage unlockFocus];
- base::mac::ScopedCFTypeRef<CGImageRef> cgImage(
- mac_util::CopyNSImageToCGImage(nsImage.get()));
+ ScopedCFTypeRef<CGImageRef> cgImage(CopyNSImageToCGImage(nsImage.get()));
EXPECT_TRUE(cgImage.get());
}
@@ -184,13 +184,14 @@ TEST_F(MacUtilTest, NSObjectRetainRelease) {
scoped_nsobject<NSArray> array([[NSArray alloc] initWithObjects:@"foo", nil]);
EXPECT_EQ(1U, [array retainCount]);
- mac_util::NSObjectRetain(array);
+ NSObjectRetain(array);
EXPECT_EQ(2U, [array retainCount]);
- mac_util::NSObjectRelease(array);
+ NSObjectRelease(array);
EXPECT_EQ(1U, [array retainCount]);
}
} // namespace
-} // namespace mac_util
+} // namespace mac
+} // namespace base