diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-18 06:14:59 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-18 06:14:59 +0000 |
commit | 631a54712d79c39bb7fbd322e3e4dc6b2429686d (patch) | |
tree | ecefa4d7d12d7dd79e489065c2555781bab9b5f5 | |
parent | e541ac7357c2178ee785764ab0415f94f5ec9bd7 (diff) | |
download | chromium_src-631a54712d79c39bb7fbd322e3e4dc6b2429686d.zip chromium_src-631a54712d79c39bb7fbd322e3e4dc6b2429686d.tar.gz chromium_src-631a54712d79c39bb7fbd322e3e4dc6b2429686d.tar.bz2 |
Fix more remaining FilePath -> base::FilePath.
This removes the "using" in file_path.h for Mac since Mac now passes trybots with no using. It still leaves the using for Windows.
Review URL: https://codereview.chromium.org/12294008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183066 0039d316-1c4b-4281-b951-d872f2087c98
31 files changed, 413 insertions, 408 deletions
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc index a06d908..bd4c791 100644 --- a/base/base_paths_win.cc +++ b/base/base_paths_win.cc @@ -16,6 +16,8 @@ // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx extern "C" IMAGE_DOS_HEADER __ImageBase; +using base::FilePath; + namespace { bool GetQuickLaunchPath(bool default_user, FilePath* result) { diff --git a/base/file_path.h b/base/file_path.h index c01da94..707d4ab 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -408,7 +408,7 @@ class BASE_EXPORT FilePath { // http://crosbug.com/39008 MTPD has a circular dependency on base and uses the // old non-namespaced FilePath. #if defined(MTPD_DEVICE_MANAGER_H_) || defined(OS_CHROMEOS) || \ - !defined(OS_LINUX) + (!defined(OS_LINUX) && !defined(OS_MAXOSX)) using base::FilePath; #endif diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 65fd6eb..199a7cf 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -25,6 +25,8 @@ #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" +using base::FilePath; + namespace file_util { namespace { diff --git a/base/file_version_info_unittest.cc b/base/file_version_info_unittest.cc index 916e7bc5..515297b3 100644 --- a/base/file_version_info_unittest.cc +++ b/base/file_version_info_unittest.cc @@ -12,6 +12,8 @@ #include "base/file_version_info_win.h" #endif +using base::FilePath; + namespace { #if defined(OS_WIN) diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc index 6528ca3..e5cd5f7 100644 --- a/base/file_version_info_win.cc +++ b/base/file_version_info_win.cc @@ -12,6 +12,8 @@ #include "base/path_service.h" #include "base/threading/thread_restrictions.h" +using base::FilePath; + FileVersionInfoWin::FileVersionInfoWin(void* data, int language, int code_page) : language_(language), code_page_(code_page) { base::ThreadRestrictions::AssertIOAllowed(); diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc index 3cfd1d1..25fe8c1 100644 --- a/base/i18n/icu_util.cc +++ b/base/i18n/icu_util.cc @@ -50,6 +50,8 @@ #endif #endif +using base::FilePath; + namespace icu_util { bool Initialize() { diff --git a/base/mac/foundation_util_unittest.mm b/base/mac/foundation_util_unittest.mm index e5577ec..6fb85d8 100644 --- a/base/mac/foundation_util_unittest.mm +++ b/base/mac/foundation_util_unittest.mm @@ -11,45 +11,46 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +namespace base { +namespace mac { + TEST(FoundationUtilTest, CFCast) { // Build out the CF types to be tested as empty containers. - base::mac::ScopedCFTypeRef<CFTypeRef> test_array( + ScopedCFTypeRef<CFTypeRef> test_array( CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_array_mutable( + ScopedCFTypeRef<CFTypeRef> test_array_mutable( CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_bag( + ScopedCFTypeRef<CFTypeRef> test_bag( CFBagCreate(NULL, NULL, 0, &kCFTypeBagCallBacks)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_bag_mutable( + ScopedCFTypeRef<CFTypeRef> test_bag_mutable( CFBagCreateMutable(NULL, 0, &kCFTypeBagCallBacks)); CFTypeRef test_bool = kCFBooleanTrue; - base::mac::ScopedCFTypeRef<CFTypeRef> test_data( + ScopedCFTypeRef<CFTypeRef> test_data( CFDataCreate(NULL, NULL, 0)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_data_mutable( + ScopedCFTypeRef<CFTypeRef> test_data_mutable( CFDataCreateMutable(NULL, 0)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_date( + ScopedCFTypeRef<CFTypeRef> test_date( CFDateCreate(NULL, 0)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_dict( + ScopedCFTypeRef<CFTypeRef> test_dict( CFDictionaryCreate(NULL, NULL, NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_dict_mutable( + ScopedCFTypeRef<CFTypeRef> test_dict_mutable( CFDictionaryCreateMutable(NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); int int_val = 256; - base::mac::ScopedCFTypeRef<CFTypeRef> test_number( + ScopedCFTypeRef<CFTypeRef> test_number( CFNumberCreate(NULL, kCFNumberIntType, &int_val)); CFTypeRef test_null = kCFNull; - base::mac::ScopedCFTypeRef<CFTypeRef> test_set( + ScopedCFTypeRef<CFTypeRef> test_set( CFSetCreate(NULL, NULL, 0, &kCFTypeSetCallBacks)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_set_mutable( + ScopedCFTypeRef<CFTypeRef> test_set_mutable( CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks)); - base::mac::ScopedCFTypeRef<CFTypeRef> test_str( - CFStringCreateWithBytes(NULL, NULL, 0, kCFStringEncodingASCII, - false)); + ScopedCFTypeRef<CFTypeRef> test_str( + CFStringCreateWithBytes(NULL, NULL, 0, kCFStringEncodingASCII, false)); CFTypeRef test_str_const = CFSTR("hello"); - base::mac::ScopedCFTypeRef<CFTypeRef> test_str_mutable( - CFStringCreateMutable(NULL, 0)); + ScopedCFTypeRef<CFTypeRef> test_str_mutable(CFStringCreateMutable(NULL, 0)); // Make sure the allocations of CF types are good. EXPECT_TRUE(test_array); @@ -71,101 +72,90 @@ TEST(FoundationUtilTest, CFCast) { EXPECT_TRUE(test_str_mutable); // Casting the CFTypeRef objects correctly provides the same pointer. - EXPECT_EQ(test_array, base::mac::CFCast<CFArrayRef>(test_array)); - EXPECT_EQ(test_array_mutable, - base::mac::CFCast<CFArrayRef>(test_array_mutable)); - EXPECT_EQ(test_bag, base::mac::CFCast<CFBagRef>(test_bag)); - EXPECT_EQ(test_bag_mutable, - base::mac::CFCast<CFBagRef>(test_bag_mutable)); - EXPECT_EQ(test_bool, base::mac::CFCast<CFBooleanRef>(test_bool)); - EXPECT_EQ(test_data, base::mac::CFCast<CFDataRef>(test_data)); - EXPECT_EQ(test_data_mutable, - base::mac::CFCast<CFDataRef>(test_data_mutable)); - EXPECT_EQ(test_date, base::mac::CFCast<CFDateRef>(test_date)); - EXPECT_EQ(test_dict, base::mac::CFCast<CFDictionaryRef>(test_dict)); - EXPECT_EQ(test_dict_mutable, - base::mac::CFCast<CFDictionaryRef>(test_dict_mutable)); - EXPECT_EQ(test_number, base::mac::CFCast<CFNumberRef>(test_number)); - EXPECT_EQ(test_null, base::mac::CFCast<CFNullRef>(test_null)); - EXPECT_EQ(test_set, base::mac::CFCast<CFSetRef>(test_set)); - EXPECT_EQ(test_set_mutable, base::mac::CFCast<CFSetRef>(test_set_mutable)); - EXPECT_EQ(test_str, base::mac::CFCast<CFStringRef>(test_str)); - EXPECT_EQ(test_str_const, base::mac::CFCast<CFStringRef>(test_str_const)); - EXPECT_EQ(test_str_mutable, - base::mac::CFCast<CFStringRef>(test_str_mutable)); + EXPECT_EQ(test_array, CFCast<CFArrayRef>(test_array)); + EXPECT_EQ(test_array_mutable, CFCast<CFArrayRef>(test_array_mutable)); + EXPECT_EQ(test_bag, CFCast<CFBagRef>(test_bag)); + EXPECT_EQ(test_bag_mutable, CFCast<CFBagRef>(test_bag_mutable)); + EXPECT_EQ(test_bool, CFCast<CFBooleanRef>(test_bool)); + EXPECT_EQ(test_data, CFCast<CFDataRef>(test_data)); + EXPECT_EQ(test_data_mutable, CFCast<CFDataRef>(test_data_mutable)); + EXPECT_EQ(test_date, CFCast<CFDateRef>(test_date)); + EXPECT_EQ(test_dict, CFCast<CFDictionaryRef>(test_dict)); + EXPECT_EQ(test_dict_mutable, CFCast<CFDictionaryRef>(test_dict_mutable)); + EXPECT_EQ(test_number, CFCast<CFNumberRef>(test_number)); + EXPECT_EQ(test_null, CFCast<CFNullRef>(test_null)); + EXPECT_EQ(test_set, CFCast<CFSetRef>(test_set)); + EXPECT_EQ(test_set_mutable, CFCast<CFSetRef>(test_set_mutable)); + EXPECT_EQ(test_str, CFCast<CFStringRef>(test_str)); + EXPECT_EQ(test_str_const, CFCast<CFStringRef>(test_str_const)); + EXPECT_EQ(test_str_mutable, CFCast<CFStringRef>(test_str_mutable)); // When given an incorrect CF cast, provide NULL. - EXPECT_FALSE(base::mac::CFCast<CFStringRef>(test_array)); - EXPECT_FALSE(base::mac::CFCast<CFStringRef>(test_array_mutable)); - EXPECT_FALSE(base::mac::CFCast<CFStringRef>(test_bag)); - EXPECT_FALSE(base::mac::CFCast<CFSetRef>(test_bag_mutable)); - EXPECT_FALSE(base::mac::CFCast<CFSetRef>(test_bool)); - EXPECT_FALSE(base::mac::CFCast<CFNullRef>(test_data)); - EXPECT_FALSE(base::mac::CFCast<CFDictionaryRef>(test_data_mutable)); - EXPECT_FALSE(base::mac::CFCast<CFDictionaryRef>(test_date)); - EXPECT_FALSE(base::mac::CFCast<CFNumberRef>(test_dict)); - EXPECT_FALSE(base::mac::CFCast<CFDateRef>(test_dict_mutable)); - EXPECT_FALSE(base::mac::CFCast<CFDataRef>(test_number)); - EXPECT_FALSE(base::mac::CFCast<CFDataRef>(test_null)); - EXPECT_FALSE(base::mac::CFCast<CFBooleanRef>(test_set)); - EXPECT_FALSE(base::mac::CFCast<CFBagRef>(test_set_mutable)); - EXPECT_FALSE(base::mac::CFCast<CFBagRef>(test_str)); - EXPECT_FALSE(base::mac::CFCast<CFArrayRef>(test_str_const)); - EXPECT_FALSE(base::mac::CFCast<CFArrayRef>(test_str_mutable)); + EXPECT_FALSE(CFCast<CFStringRef>(test_array)); + EXPECT_FALSE(CFCast<CFStringRef>(test_array_mutable)); + EXPECT_FALSE(CFCast<CFStringRef>(test_bag)); + EXPECT_FALSE(CFCast<CFSetRef>(test_bag_mutable)); + EXPECT_FALSE(CFCast<CFSetRef>(test_bool)); + EXPECT_FALSE(CFCast<CFNullRef>(test_data)); + EXPECT_FALSE(CFCast<CFDictionaryRef>(test_data_mutable)); + EXPECT_FALSE(CFCast<CFDictionaryRef>(test_date)); + EXPECT_FALSE(CFCast<CFNumberRef>(test_dict)); + EXPECT_FALSE(CFCast<CFDateRef>(test_dict_mutable)); + EXPECT_FALSE(CFCast<CFDataRef>(test_number)); + EXPECT_FALSE(CFCast<CFDataRef>(test_null)); + EXPECT_FALSE(CFCast<CFBooleanRef>(test_set)); + EXPECT_FALSE(CFCast<CFBagRef>(test_set_mutable)); + EXPECT_FALSE(CFCast<CFBagRef>(test_str)); + EXPECT_FALSE(CFCast<CFArrayRef>(test_str_const)); + EXPECT_FALSE(CFCast<CFArrayRef>(test_str_mutable)); // Giving a NULL provides a NULL. - EXPECT_FALSE(base::mac::CFCast<CFArrayRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFBagRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFBooleanRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFDataRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFDateRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFDictionaryRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFNullRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFNumberRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFSetRef>(NULL)); - EXPECT_FALSE(base::mac::CFCast<CFStringRef>(NULL)); + EXPECT_FALSE(CFCast<CFArrayRef>(NULL)); + EXPECT_FALSE(CFCast<CFBagRef>(NULL)); + EXPECT_FALSE(CFCast<CFBooleanRef>(NULL)); + EXPECT_FALSE(CFCast<CFDataRef>(NULL)); + EXPECT_FALSE(CFCast<CFDateRef>(NULL)); + EXPECT_FALSE(CFCast<CFDictionaryRef>(NULL)); + EXPECT_FALSE(CFCast<CFNullRef>(NULL)); + EXPECT_FALSE(CFCast<CFNumberRef>(NULL)); + EXPECT_FALSE(CFCast<CFSetRef>(NULL)); + EXPECT_FALSE(CFCast<CFStringRef>(NULL)); // CFCastStrict: correct cast results in correct pointer being returned. - EXPECT_EQ(test_array, base::mac::CFCastStrict<CFArrayRef>(test_array)); - EXPECT_EQ(test_array_mutable, - base::mac::CFCastStrict<CFArrayRef>(test_array_mutable)); - EXPECT_EQ(test_bag, base::mac::CFCastStrict<CFBagRef>(test_bag)); - EXPECT_EQ(test_bag_mutable, - base::mac::CFCastStrict<CFBagRef>(test_bag_mutable)); - EXPECT_EQ(test_bool, base::mac::CFCastStrict<CFBooleanRef>(test_bool)); - EXPECT_EQ(test_data, base::mac::CFCastStrict<CFDataRef>(test_data)); - EXPECT_EQ(test_data_mutable, - base::mac::CFCastStrict<CFDataRef>(test_data_mutable)); - EXPECT_EQ(test_date, base::mac::CFCastStrict<CFDateRef>(test_date)); - EXPECT_EQ(test_dict, base::mac::CFCastStrict<CFDictionaryRef>(test_dict)); + EXPECT_EQ(test_array, CFCastStrict<CFArrayRef>(test_array)); + EXPECT_EQ(test_array_mutable, CFCastStrict<CFArrayRef>(test_array_mutable)); + EXPECT_EQ(test_bag, CFCastStrict<CFBagRef>(test_bag)); + EXPECT_EQ(test_bag_mutable, CFCastStrict<CFBagRef>(test_bag_mutable)); + EXPECT_EQ(test_bool, CFCastStrict<CFBooleanRef>(test_bool)); + EXPECT_EQ(test_data, CFCastStrict<CFDataRef>(test_data)); + EXPECT_EQ(test_data_mutable, CFCastStrict<CFDataRef>(test_data_mutable)); + EXPECT_EQ(test_date, CFCastStrict<CFDateRef>(test_date)); + EXPECT_EQ(test_dict, CFCastStrict<CFDictionaryRef>(test_dict)); EXPECT_EQ(test_dict_mutable, - base::mac::CFCastStrict<CFDictionaryRef>(test_dict_mutable)); - EXPECT_EQ(test_number, base::mac::CFCastStrict<CFNumberRef>(test_number)); - EXPECT_EQ(test_null, base::mac::CFCastStrict<CFNullRef>(test_null)); - EXPECT_EQ(test_set, base::mac::CFCastStrict<CFSetRef>(test_set)); - EXPECT_EQ(test_set_mutable, - base::mac::CFCastStrict<CFSetRef>(test_set_mutable)); - EXPECT_EQ(test_str, base::mac::CFCastStrict<CFStringRef>(test_str)); - EXPECT_EQ(test_str_const, - base::mac::CFCastStrict<CFStringRef>(test_str_const)); - EXPECT_EQ(test_str_mutable, - base::mac::CFCastStrict<CFStringRef>(test_str_mutable)); + CFCastStrict<CFDictionaryRef>(test_dict_mutable)); + EXPECT_EQ(test_number, CFCastStrict<CFNumberRef>(test_number)); + EXPECT_EQ(test_null, CFCastStrict<CFNullRef>(test_null)); + EXPECT_EQ(test_set, CFCastStrict<CFSetRef>(test_set)); + EXPECT_EQ(test_set_mutable, CFCastStrict<CFSetRef>(test_set_mutable)); + EXPECT_EQ(test_str, CFCastStrict<CFStringRef>(test_str)); + EXPECT_EQ(test_str_const, CFCastStrict<CFStringRef>(test_str_const)); + EXPECT_EQ(test_str_mutable, CFCastStrict<CFStringRef>(test_str_mutable)); // CFCastStrict: Giving a NULL provides a NULL. - EXPECT_FALSE(base::mac::CFCastStrict<CFArrayRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFBagRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFBooleanRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFDataRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFDateRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFDictionaryRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFNullRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFNumberRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFSetRef>(NULL)); - EXPECT_FALSE(base::mac::CFCastStrict<CFStringRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFArrayRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFBagRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFBooleanRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFDataRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFDateRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFDictionaryRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFNullRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFNumberRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFSetRef>(NULL)); + EXPECT_FALSE(CFCastStrict<CFStringRef>(NULL)); } TEST(FoundationUtilTest, ObjCCast) { - base::mac::ScopedNSAutoreleasePool pool; + ScopedNSAutoreleasePool pool; id test_array = [NSArray array]; id test_array_mutable = [NSMutableArray array]; @@ -201,92 +191,88 @@ TEST(FoundationUtilTest, ObjCCast) { EXPECT_TRUE(test_str_mutable); // Casting the id correctly provides the same pointer. - EXPECT_EQ(test_array, base::mac::ObjCCast<NSArray>(test_array)); - EXPECT_EQ(test_array_mutable, - base::mac::ObjCCast<NSArray>(test_array_mutable)); - EXPECT_EQ(test_data, base::mac::ObjCCast<NSData>(test_data)); - EXPECT_EQ(test_data_mutable, - base::mac::ObjCCast<NSData>(test_data_mutable)); - EXPECT_EQ(test_date, base::mac::ObjCCast<NSDate>(test_date)); - EXPECT_EQ(test_dict, base::mac::ObjCCast<NSDictionary>(test_dict)); - EXPECT_EQ(test_dict_mutable, - base::mac::ObjCCast<NSDictionary>(test_dict_mutable)); - EXPECT_EQ(test_number, base::mac::ObjCCast<NSNumber>(test_number)); - EXPECT_EQ(test_null, base::mac::ObjCCast<NSNull>(test_null)); - EXPECT_EQ(test_set, base::mac::ObjCCast<NSSet>(test_set)); - EXPECT_EQ(test_set_mutable, base::mac::ObjCCast<NSSet>(test_set_mutable)); - EXPECT_EQ(test_str, base::mac::ObjCCast<NSString>(test_str)); - EXPECT_EQ(test_str_const, base::mac::ObjCCast<NSString>(test_str_const)); - EXPECT_EQ(test_str_mutable, - base::mac::ObjCCast<NSString>(test_str_mutable)); + EXPECT_EQ(test_array, ObjCCast<NSArray>(test_array)); + EXPECT_EQ(test_array_mutable, ObjCCast<NSArray>(test_array_mutable)); + EXPECT_EQ(test_data, ObjCCast<NSData>(test_data)); + EXPECT_EQ(test_data_mutable, ObjCCast<NSData>(test_data_mutable)); + EXPECT_EQ(test_date, ObjCCast<NSDate>(test_date)); + EXPECT_EQ(test_dict, ObjCCast<NSDictionary>(test_dict)); + EXPECT_EQ(test_dict_mutable, ObjCCast<NSDictionary>(test_dict_mutable)); + EXPECT_EQ(test_number, ObjCCast<NSNumber>(test_number)); + EXPECT_EQ(test_null, ObjCCast<NSNull>(test_null)); + EXPECT_EQ(test_set, ObjCCast<NSSet>(test_set)); + EXPECT_EQ(test_set_mutable, ObjCCast<NSSet>(test_set_mutable)); + EXPECT_EQ(test_str, ObjCCast<NSString>(test_str)); + EXPECT_EQ(test_str_const, ObjCCast<NSString>(test_str_const)); + EXPECT_EQ(test_str_mutable, ObjCCast<NSString>(test_str_mutable)); // When given an incorrect ObjC cast, provide nil. - EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_array)); - EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_array_mutable)); - EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_data)); - EXPECT_FALSE(base::mac::ObjCCast<NSString>(test_data_mutable)); - EXPECT_FALSE(base::mac::ObjCCast<NSSet>(test_date)); - EXPECT_FALSE(base::mac::ObjCCast<NSSet>(test_dict)); - EXPECT_FALSE(base::mac::ObjCCast<NSNumber>(test_dict_mutable)); - EXPECT_FALSE(base::mac::ObjCCast<NSNull>(test_number)); - EXPECT_FALSE(base::mac::ObjCCast<NSDictionary>(test_null)); - EXPECT_FALSE(base::mac::ObjCCast<NSDictionary>(test_set)); - EXPECT_FALSE(base::mac::ObjCCast<NSDate>(test_set_mutable)); - EXPECT_FALSE(base::mac::ObjCCast<NSData>(test_str)); - EXPECT_FALSE(base::mac::ObjCCast<NSData>(test_str_const)); - EXPECT_FALSE(base::mac::ObjCCast<NSArray>(test_str_mutable)); + EXPECT_FALSE(ObjCCast<NSString>(test_array)); + EXPECT_FALSE(ObjCCast<NSString>(test_array_mutable)); + EXPECT_FALSE(ObjCCast<NSString>(test_data)); + EXPECT_FALSE(ObjCCast<NSString>(test_data_mutable)); + EXPECT_FALSE(ObjCCast<NSSet>(test_date)); + EXPECT_FALSE(ObjCCast<NSSet>(test_dict)); + EXPECT_FALSE(ObjCCast<NSNumber>(test_dict_mutable)); + EXPECT_FALSE(ObjCCast<NSNull>(test_number)); + EXPECT_FALSE(ObjCCast<NSDictionary>(test_null)); + EXPECT_FALSE(ObjCCast<NSDictionary>(test_set)); + EXPECT_FALSE(ObjCCast<NSDate>(test_set_mutable)); + EXPECT_FALSE(ObjCCast<NSData>(test_str)); + EXPECT_FALSE(ObjCCast<NSData>(test_str_const)); + EXPECT_FALSE(ObjCCast<NSArray>(test_str_mutable)); // Giving a nil provides a nil. - EXPECT_FALSE(base::mac::ObjCCast<NSArray>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSData>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSDate>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSDictionary>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSNull>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSNumber>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSSet>(nil)); - EXPECT_FALSE(base::mac::ObjCCast<NSString>(nil)); + EXPECT_FALSE(ObjCCast<NSArray>(nil)); + EXPECT_FALSE(ObjCCast<NSData>(nil)); + EXPECT_FALSE(ObjCCast<NSDate>(nil)); + EXPECT_FALSE(ObjCCast<NSDictionary>(nil)); + EXPECT_FALSE(ObjCCast<NSNull>(nil)); + EXPECT_FALSE(ObjCCast<NSNumber>(nil)); + EXPECT_FALSE(ObjCCast<NSSet>(nil)); + EXPECT_FALSE(ObjCCast<NSString>(nil)); // ObjCCastStrict: correct cast results in correct pointer being returned. - EXPECT_EQ(test_array, base::mac::ObjCCastStrict<NSArray>(test_array)); + EXPECT_EQ(test_array, ObjCCastStrict<NSArray>(test_array)); EXPECT_EQ(test_array_mutable, - base::mac::ObjCCastStrict<NSArray>(test_array_mutable)); - EXPECT_EQ(test_data, base::mac::ObjCCastStrict<NSData>(test_data)); + ObjCCastStrict<NSArray>(test_array_mutable)); + EXPECT_EQ(test_data, ObjCCastStrict<NSData>(test_data)); EXPECT_EQ(test_data_mutable, - base::mac::ObjCCastStrict<NSData>(test_data_mutable)); - EXPECT_EQ(test_date, base::mac::ObjCCastStrict<NSDate>(test_date)); - EXPECT_EQ(test_dict, base::mac::ObjCCastStrict<NSDictionary>(test_dict)); + ObjCCastStrict<NSData>(test_data_mutable)); + EXPECT_EQ(test_date, ObjCCastStrict<NSDate>(test_date)); + EXPECT_EQ(test_dict, ObjCCastStrict<NSDictionary>(test_dict)); EXPECT_EQ(test_dict_mutable, - base::mac::ObjCCastStrict<NSDictionary>(test_dict_mutable)); - EXPECT_EQ(test_number, base::mac::ObjCCastStrict<NSNumber>(test_number)); - EXPECT_EQ(test_null, base::mac::ObjCCastStrict<NSNull>(test_null)); - EXPECT_EQ(test_set, base::mac::ObjCCastStrict<NSSet>(test_set)); + ObjCCastStrict<NSDictionary>(test_dict_mutable)); + EXPECT_EQ(test_number, ObjCCastStrict<NSNumber>(test_number)); + EXPECT_EQ(test_null, ObjCCastStrict<NSNull>(test_null)); + EXPECT_EQ(test_set, ObjCCastStrict<NSSet>(test_set)); EXPECT_EQ(test_set_mutable, - base::mac::ObjCCastStrict<NSSet>(test_set_mutable)); - EXPECT_EQ(test_str, base::mac::ObjCCastStrict<NSString>(test_str)); + ObjCCastStrict<NSSet>(test_set_mutable)); + EXPECT_EQ(test_str, ObjCCastStrict<NSString>(test_str)); EXPECT_EQ(test_str_const, - base::mac::ObjCCastStrict<NSString>(test_str_const)); + ObjCCastStrict<NSString>(test_str_const)); EXPECT_EQ(test_str_mutable, - base::mac::ObjCCastStrict<NSString>(test_str_mutable)); + ObjCCastStrict<NSString>(test_str_mutable)); // ObjCCastStrict: Giving a nil provides a nil. - EXPECT_FALSE(base::mac::ObjCCastStrict<NSArray>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSData>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSDate>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSDictionary>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSNull>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSNumber>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSSet>(nil)); - EXPECT_FALSE(base::mac::ObjCCastStrict<NSString>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSArray>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSData>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSDate>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSDictionary>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSNull>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSNumber>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSSet>(nil)); + EXPECT_FALSE(ObjCCastStrict<NSString>(nil)); } TEST(FoundationUtilTest, GetValueFromDictionary) { int one = 1, two = 2, three = 3; - base::mac::ScopedCFTypeRef<CFNumberRef> cf_one( + ScopedCFTypeRef<CFNumberRef> cf_one( CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one)); - base::mac::ScopedCFTypeRef<CFNumberRef> cf_two( + ScopedCFTypeRef<CFNumberRef> cf_two( CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &two)); - base::mac::ScopedCFTypeRef<CFNumberRef> cf_three( + ScopedCFTypeRef<CFNumberRef> cf_three( CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &three)); CFStringRef keys[] = { CFSTR("one"), CFSTR("two"), CFSTR("three") }; @@ -295,7 +281,7 @@ TEST(FoundationUtilTest, GetValueFromDictionary) { COMPILE_ASSERT(arraysize(keys) == arraysize(values), keys_and_values_arraysizes_are_different); - base::mac::ScopedCFTypeRef<CFDictionaryRef> test_dict( + ScopedCFTypeRef<CFDictionaryRef> test_dict( CFDictionaryCreate(kCFAllocatorDefault, reinterpret_cast<const void**>(keys), reinterpret_cast<const void**>(values), @@ -303,33 +289,31 @@ TEST(FoundationUtilTest, GetValueFromDictionary) { &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - // base::mac::GetValueFromDictionary<>(_, _) should produce the correct + // GetValueFromDictionary<>(_, _) should produce the correct // expected output. EXPECT_EQ(values[0], - base::mac::GetValueFromDictionary<CFNumberRef>(test_dict, - CFSTR("one"))); + GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("one"))); EXPECT_EQ(values[1], - base::mac::GetValueFromDictionary<CFNumberRef>(test_dict, - CFSTR("two"))); + GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("two"))); EXPECT_EQ(values[2], - base::mac::GetValueFromDictionary<CFNumberRef>(test_dict, - CFSTR("three"))); + GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("three"))); // Bad input should produce bad output. - EXPECT_FALSE(base::mac::GetValueFromDictionary<CFNumberRef>(test_dict, - CFSTR("four"))); - EXPECT_FALSE(base::mac::GetValueFromDictionary<CFStringRef>(test_dict, - CFSTR("one"))); + EXPECT_FALSE(GetValueFromDictionary<CFNumberRef>(test_dict, CFSTR("four"))); + EXPECT_FALSE(GetValueFromDictionary<CFStringRef>(test_dict, CFSTR("one"))); } TEST(FoundationUtilTest, FilePathToNSString) { - EXPECT_NSEQ(nil, base::mac::FilePathToNSString(FilePath())); - EXPECT_NSEQ(@"/a/b", base::mac::FilePathToNSString(FilePath("/a/b"))); + EXPECT_NSEQ(nil, FilePathToNSString(FilePath())); + EXPECT_NSEQ(@"/a/b", FilePathToNSString(FilePath("/a/b"))); } // http://crbug.com/173983 Fails consistently under Mac ASAN. TEST(FoundationUtilTest, DISABLED_NSStringToFilePath) { - EXPECT_EQ(FilePath(), base::mac::NSStringToFilePath(nil)); - EXPECT_EQ(FilePath(), base::mac::NSStringToFilePath(@"")); - EXPECT_EQ(FilePath("/a/b"), base::mac::NSStringToFilePath(@"/a/b")); + EXPECT_EQ(FilePath(), NSStringToFilePath(nil)); + EXPECT_EQ(FilePath(), NSStringToFilePath(@"")); + EXPECT_EQ(FilePath("/a/b"), NSStringToFilePath(@"/a/b")); } + +} // namespace mac +} // namespace base diff --git a/base/win/event_trace_consumer_unittest.cc b/base/win/event_trace_consumer_unittest.cc index 7af9452..9e9297c 100644 --- a/base/win/event_trace_consumer_unittest.cc +++ b/base/win/event_trace_consumer_unittest.cc @@ -23,13 +23,10 @@ #include <initguid.h> // NOLINT - has to be last -namespace { +namespace base { +namespace win { -using base::win::EtwMofEvent; -using base::win::EtwTraceController; -using base::win::EtwTraceConsumerBase; -using base::win::EtwTraceProperties; -using base::win::EtwTraceProvider; +namespace { typedef std::list<EVENT_TRACE> EventQueue; @@ -70,21 +67,21 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> { ::SetEvent(sank_event_.Get()); } - static base::win::ScopedHandle sank_event_; + static ScopedHandle sank_event_; static EventQueue events_; private: DISALLOW_COPY_AND_ASSIGN(TestConsumer); }; -base::win::ScopedHandle TestConsumer::sank_event_; +ScopedHandle TestConsumer::sank_event_; EventQueue TestConsumer::events_; class EtwTraceConsumerBaseTest: public testing::Test { public: EtwTraceConsumerBaseTest() - : session_name_(base::StringPrintf(L"TestSession-%d", - base::Process::Current().pid())) { + : session_name_(StringPrintf(L"TestSession-%d", + Process::Current().pid())) { } virtual void SetUp() { @@ -206,8 +203,8 @@ class EtwTraceConsumerRealtimeTest: public EtwTraceConsumerBaseTest { } TestConsumer consumer_; - base::win::ScopedHandle consumer_ready_; - base::win::ScopedHandle consumer_thread_; + ScopedHandle consumer_ready_; + ScopedHandle consumer_thread_; }; } // namespace @@ -356,7 +353,7 @@ class EtwTraceConsumerDataTest: public EtwTraceConsumerBaseTest { } EventQueue events_; - base::ScopedTempDir temp_dir_; + ScopedTempDir temp_dir_; FilePath temp_file_; }; @@ -381,3 +378,6 @@ TEST_F(EtwTraceConsumerDataTest, RoundTrip) { ASSERT_EQ(sizeof(kData), trace->MofLength); ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); } + +} // namespace win +} // namespace base diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc index fae606e..82c4106 100644 --- a/base/win/event_trace_controller_unittest.cc +++ b/base/win/event_trace_controller_unittest.cc @@ -19,11 +19,10 @@ #include "base/win/scoped_handle.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { +namespace base { +namespace win { -using base::win::EtwTraceController; -using base::win::EtwTraceProvider; -using base::win::EtwTraceProperties; +namespace { DEFINE_GUID(kGuidNull, 0x0000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0); @@ -50,7 +49,7 @@ class TestingProvider: public EtwTraceProvider { ::SetEvent(callback_event_.Get()); } - base::win::ScopedHandle callback_event_; + ScopedHandle callback_event_; DISALLOW_COPY_AND_ASSIGN(TestingProvider); }; @@ -110,8 +109,9 @@ namespace { class EtwTraceControllerTest : public testing::Test { public: - EtwTraceControllerTest() : session_name_( - base::StringPrintf(L"TestSession-%d", base::Process::Current().pid())) { + EtwTraceControllerTest() + : session_name_( + StringPrintf(L"TestSession-%d", Process::Current().pid())) { } virtual void SetUp() { @@ -161,7 +161,7 @@ TEST_F(EtwTraceControllerTest, StartRealTimeSession) { } TEST_F(EtwTraceControllerTest, StartFileSession) { - base::ScopedTempDir temp_dir; + ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); FilePath temp; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp)); @@ -234,3 +234,6 @@ TEST_F(EtwTraceControllerTest, EnableDisable) { EXPECT_EQ(0, provider.enable_level()); EXPECT_EQ(0, provider.enable_flags()); } + +} // namespace win +} // namespace base diff --git a/base/win/shortcut_unittest.cc b/base/win/shortcut_unittest.cc index 70cc852..14aab29 100644 --- a/base/win/shortcut_unittest.cc +++ b/base/win/shortcut_unittest.cc @@ -14,6 +14,9 @@ #include "base/win/scoped_com_initializer.h" #include "testing/gtest/include/gtest/gtest.h" +namespace base { +namespace win { + namespace { static const char kFileContents[] = "This is a target."; @@ -61,31 +64,31 @@ class ShortcutTest : public testing::Test { } } - base::win::ScopedCOMInitializer com_initializer_; - base::ScopedTempDir temp_dir_; - base::ScopedTempDir temp_dir_2_; + ScopedCOMInitializer com_initializer_; + ScopedTempDir temp_dir_; + ScopedTempDir temp_dir_2_; // The link file to be created/updated in the shortcut tests below. FilePath link_file_; // Properties for the created shortcut. - base::win::ShortcutProperties link_properties_; + ShortcutProperties link_properties_; // Properties for the updated shortcut. - base::win::ShortcutProperties link_properties_2_; + ShortcutProperties link_properties_2_; }; } // namespace TEST_F(ShortcutTest, CreateAndResolveShortcut) { - base::win::ShortcutProperties only_target_properties; + ShortcutProperties only_target_properties; only_target_properties.set_target(link_properties_.target); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, only_target_properties, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, only_target_properties, SHORTCUT_CREATE_ALWAYS)); FilePath resolved_name; - EXPECT_TRUE(base::win::ResolveShortcut(link_file_, &resolved_name, NULL)); + EXPECT_TRUE(ResolveShortcut(link_file_, &resolved_name, NULL)); char read_contents[arraysize(kFileContents)]; file_util::ReadFile(resolved_name, read_contents, arraysize(read_contents)); @@ -93,12 +96,12 @@ TEST_F(ShortcutTest, CreateAndResolveShortcut) { } TEST_F(ShortcutTest, ResolveShortcutWithArgs) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); FilePath resolved_name; string16 args; - EXPECT_TRUE(base::win::ResolveShortcut(link_file_, &resolved_name, &args)); + EXPECT_TRUE(ResolveShortcut(link_file_, &resolved_name, &args)); char read_contents[arraysize(kFileContents)]; file_util::ReadFile(resolved_name, read_contents, arraysize(read_contents)); @@ -107,51 +110,51 @@ TEST_F(ShortcutTest, ResolveShortcutWithArgs) { } TEST_F(ShortcutTest, CreateShortcutWithOnlySomeProperties) { - base::win::ShortcutProperties target_and_args_properties; + ShortcutProperties target_and_args_properties; target_and_args_properties.set_target(link_properties_.target); target_and_args_properties.set_arguments(link_properties_.arguments); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( + ASSERT_TRUE(CreateOrUpdateShortcutLink( link_file_, target_and_args_properties, - base::win::SHORTCUT_CREATE_ALWAYS)); + SHORTCUT_CREATE_ALWAYS)); - base::win::ValidateShortcut(link_file_, target_and_args_properties); + ValidateShortcut(link_file_, target_and_args_properties); } TEST_F(ShortcutTest, CreateShortcutVerifyProperties) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - base::win::ValidateShortcut(link_file_, link_properties_); + ValidateShortcut(link_file_, link_properties_); } TEST_F(ShortcutTest, UpdateShortcutVerifyProperties) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_2_, base::win::SHORTCUT_UPDATE_EXISTING)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_2_, SHORTCUT_UPDATE_EXISTING)); - base::win::ValidateShortcut(link_file_, link_properties_2_); + ValidateShortcut(link_file_, link_properties_2_); } TEST_F(ShortcutTest, UpdateShortcutUpdateOnlyTargetAndResolve) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - base::win::ShortcutProperties update_only_target_properties; + ShortcutProperties update_only_target_properties; update_only_target_properties.set_target(link_properties_2_.target); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( + ASSERT_TRUE(CreateOrUpdateShortcutLink( link_file_, update_only_target_properties, - base::win::SHORTCUT_UPDATE_EXISTING)); + SHORTCUT_UPDATE_EXISTING)); - base::win::ShortcutProperties expected_properties = link_properties_; + ShortcutProperties expected_properties = link_properties_; expected_properties.set_target(link_properties_2_.target); - base::win::ValidateShortcut(link_file_, expected_properties); + ValidateShortcut(link_file_, expected_properties); FilePath resolved_name; - EXPECT_TRUE(base::win::ResolveShortcut(link_file_, &resolved_name, NULL)); + EXPECT_TRUE(ResolveShortcut(link_file_, &resolved_name, NULL)); char read_contents[arraysize(kFileContents2)]; file_util::ReadFile(resolved_name, read_contents, arraysize(read_contents)); @@ -159,109 +162,112 @@ TEST_F(ShortcutTest, UpdateShortcutUpdateOnlyTargetAndResolve) { } TEST_F(ShortcutTest, UpdateShortcutMakeDualMode) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - base::win::ShortcutProperties make_dual_mode_properties; + ShortcutProperties make_dual_mode_properties; make_dual_mode_properties.set_dual_mode(true); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( + ASSERT_TRUE(CreateOrUpdateShortcutLink( link_file_, make_dual_mode_properties, - base::win::SHORTCUT_UPDATE_EXISTING)); + SHORTCUT_UPDATE_EXISTING)); - base::win::ShortcutProperties expected_properties = link_properties_; + ShortcutProperties expected_properties = link_properties_; expected_properties.set_dual_mode(true); - base::win::ValidateShortcut(link_file_, expected_properties); + ValidateShortcut(link_file_, expected_properties); } TEST_F(ShortcutTest, UpdateShortcutRemoveDualMode) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_2_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_2_, SHORTCUT_CREATE_ALWAYS)); - base::win::ShortcutProperties remove_dual_mode_properties; + ShortcutProperties remove_dual_mode_properties; remove_dual_mode_properties.set_dual_mode(false); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( + ASSERT_TRUE(CreateOrUpdateShortcutLink( link_file_, remove_dual_mode_properties, - base::win::SHORTCUT_UPDATE_EXISTING)); + SHORTCUT_UPDATE_EXISTING)); - base::win::ShortcutProperties expected_properties = link_properties_2_; + ShortcutProperties expected_properties = link_properties_2_; expected_properties.set_dual_mode(false); - base::win::ValidateShortcut(link_file_, expected_properties); + ValidateShortcut(link_file_, expected_properties); } TEST_F(ShortcutTest, UpdateShortcutClearArguments) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - base::win::ShortcutProperties clear_arguments_properties; + ShortcutProperties clear_arguments_properties; clear_arguments_properties.set_arguments(string16()); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( + ASSERT_TRUE(CreateOrUpdateShortcutLink( link_file_, clear_arguments_properties, - base::win::SHORTCUT_UPDATE_EXISTING)); + SHORTCUT_UPDATE_EXISTING)); - base::win::ShortcutProperties expected_properties = link_properties_; + ShortcutProperties expected_properties = link_properties_; expected_properties.set_arguments(string16()); - base::win::ValidateShortcut(link_file_, expected_properties); + ValidateShortcut(link_file_, expected_properties); } TEST_F(ShortcutTest, FailUpdateShortcutThatDoesNotExist) { - ASSERT_FALSE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_UPDATE_EXISTING)); + ASSERT_FALSE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_UPDATE_EXISTING)); ASSERT_FALSE(file_util::PathExists(link_file_)); } TEST_F(ShortcutTest, ReplaceShortcutAllProperties) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_2_, base::win::SHORTCUT_REPLACE_EXISTING)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING)); - base::win::ValidateShortcut(link_file_, link_properties_2_); + ValidateShortcut(link_file_, link_properties_2_); } TEST_F(ShortcutTest, ReplaceShortcutSomeProperties) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); - base::win::ShortcutProperties new_properties; + ShortcutProperties new_properties; new_properties.set_target(link_properties_2_.target); new_properties.set_arguments(link_properties_2_.arguments); new_properties.set_description(link_properties_2_.description); - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, new_properties, base::win::SHORTCUT_REPLACE_EXISTING)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, new_properties, SHORTCUT_REPLACE_EXISTING)); // Expect only properties in |new_properties| to be set, all other properties // should have been overwritten. - base::win::ShortcutProperties expected_properties(new_properties); + ShortcutProperties expected_properties(new_properties); expected_properties.set_working_dir(FilePath()); expected_properties.set_icon(FilePath(), 0); expected_properties.set_app_id(string16()); expected_properties.set_dual_mode(false); - base::win::ValidateShortcut(link_file_, expected_properties); + ValidateShortcut(link_file_, expected_properties); } TEST_F(ShortcutTest, FailReplaceShortcutThatDoesNotExist) { - ASSERT_FALSE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_REPLACE_EXISTING)); + ASSERT_FALSE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_REPLACE_EXISTING)); ASSERT_FALSE(file_util::PathExists(link_file_)); } // Test that the old arguments remain on the replaced shortcut when not // otherwise specified. TEST_F(ShortcutTest, ReplaceShortcutKeepOldArguments) { - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS)); + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); // Do not explicitly set the arguments. link_properties_2_.options &= - ~base::win::ShortcutProperties::PROPERTIES_ARGUMENTS; - ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( - link_file_, link_properties_2_, base::win::SHORTCUT_REPLACE_EXISTING)); + ~ShortcutProperties::PROPERTIES_ARGUMENTS; + ASSERT_TRUE(CreateOrUpdateShortcutLink( + link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING)); - base::win::ShortcutProperties expected_properties(link_properties_2_); + ShortcutProperties expected_properties(link_properties_2_); expected_properties.set_arguments(link_properties_.arguments); - base::win::ValidateShortcut(link_file_, expected_properties); + ValidateShortcut(link_file_, expected_properties); } + +} // namespace win +} // namespace base diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index ef32042..08d1891 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -313,7 +313,8 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, const std::wstring& type, const std::wstring& channel) { scoped_ptr<FileVersionInfo> - version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); + version_info(FileVersionInfo::CreateFileVersionInfo( + base::FilePath(exe_path))); std::wstring version, product; std::wstring special_build; diff --git a/chrome/app/chrome_main_mac.mm b/chrome/app/chrome_main_mac.mm index 7923836..65a70bf 100644 --- a/chrome/app/chrome_main_mac.mm +++ b/chrome/app/chrome_main_mac.mm @@ -19,7 +19,7 @@ #include "chrome/common/chrome_paths_internal.h" #include "policy/policy_constants.h" -void CheckUserDataDirPolicy(FilePath* user_data_dir) { +void CheckUserDataDirPolicy(base::FilePath* user_data_dir) { base::mac::ScopedNSAutoreleasePool pool; // Since the configuration management infrastructure is not initialized when @@ -32,7 +32,7 @@ void CheckUserDataDirPolicy(FilePath* user_data_dir) { // Now replace any vars the user might have used. string_value = policy::path_parser::ExpandPathVariables(string_value); - *user_data_dir = FilePath(string_value); + *user_data_dir = base::FilePath(string_value); } } diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index 66c9769..38f6316 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -673,7 +673,7 @@ void FileBrowserEventRouter::ShowRemovableDeviceInFileManager( chromeos::ScreenLocker::default_screen_locker()) return; - file_manager_util::OpenActionChoiceDialog(FilePath(mount_path)); + file_manager_util::OpenActionChoiceDialog(base::FilePath(mount_path)); } void FileBrowserEventRouter::OnDiskAdded( diff --git a/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc b/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc index 67ece85b..635031f 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc @@ -45,7 +45,7 @@ class TestListener : public ui::SelectFileDialog::Listener { int file_index() const { return file_index_; } // ui::SelectFileDialog::Listener implementation - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE { selected_ = true; diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index ce6f208..5224191 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -258,7 +258,7 @@ namespace web_app { namespace internals { -FilePath GetAppBundleByExtensionId(std::string extension_id) { +base::FilePath GetAppBundleByExtensionId(std::string extension_id) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); // This matches APP_MODE_APP_BUNDLE_ID in chrome/chrome.gyp. std::string bundle_id = @@ -271,10 +271,10 @@ FilePath GetAppBundleByExtensionId(std::string extension_id) { base::mac::ScopedCFTypeRef<CFURLRef> url(url_ref); if (status != noErr) - return FilePath(); + return base::FilePath(); NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; - return FilePath([path_string fileSystemRepresentation]); + return base::FilePath([path_string fileSystemRepresentation]); } bool CreatePlatformShortcuts( @@ -292,7 +292,7 @@ void DeletePlatformShortcuts( const ShellIntegration::ShortcutInfo& info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); - FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); + base::FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); file_util::Delete(bundle_path, true); } diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc index 9e84f12..8731d71 100644 --- a/chrome/installer/launcher_support/chrome_launcher_support.cc +++ b/chrome/installer/launcher_support/chrome_launcher_support.cc @@ -45,7 +45,7 @@ const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; const wchar_t kUninstallStringField[] = L"UninstallString"; #ifndef OFFICIAL_BUILD -FilePath GetDevelopmentExe(const wchar_t* exe_file) { +base::FilePath GetDevelopmentExe(const wchar_t* exe_file) { base::FilePath current_directory; if (PathService::Get(base::DIR_EXE, ¤t_directory)) { base::FilePath chrome_exe_path(current_directory.Append(exe_file)); @@ -107,8 +107,8 @@ bool IsAppLauncherEnabledAtLevel(InstallationLevel level) { // Reads the path to setup.exe from the value "UninstallString" within the // specified product's "ClientState" registry key. Returns an empty FilePath if // an error occurs or the product is not installed at the specified level. -FilePath GetSetupExeFromRegistry(InstallationLevel level, - const wchar_t* app_guid) { +base::FilePath GetSetupExeFromRegistry(InstallationLevel level, + const wchar_t* app_guid) { string16 uninstall; if (GetClientStateValue(level, app_guid, kUninstallStringField, &uninstall)) { base::FilePath setup_exe_path(uninstall); @@ -121,8 +121,8 @@ FilePath GetSetupExeFromRegistry(InstallationLevel level, // Returns the path to an installed |exe_file| (e.g. chrome.exe, app_host.exe) // at the specified level, given |setup_exe_path| from Omaha client state. // Returns empty base::FilePath if none found, or if |setup_exe_path| is empty. -FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path, - const wchar_t* exe_file) { +base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path, + const wchar_t* exe_file) { if (!setup_exe_path.empty()) { // The uninstall path contains the path to setup.exe, which is two levels // down from |exe_file|. Move up two levels (plus one to drop the file @@ -142,7 +142,7 @@ FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path, } // namespace -FilePath GetSetupExeForInstallationLevel(InstallationLevel level) { +base::FilePath GetSetupExeForInstallationLevel(InstallationLevel level) { // Look in the registry for Chrome Binaries first. base::FilePath setup_exe_path( GetSetupExeFromRegistry(level, kBinariesAppGuid)); @@ -153,17 +153,17 @@ FilePath GetSetupExeForInstallationLevel(InstallationLevel level) { return setup_exe_path; } -FilePath GetChromePathForInstallationLevel(InstallationLevel level) { +base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { return FindExeRelativeToSetupExe( GetSetupExeForInstallationLevel(level), kChromeExe); } -FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) { +base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) { return FindExeRelativeToSetupExe( GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe); } -FilePath GetAnyChromePath() { +base::FilePath GetAnyChromePath() { base::FilePath chrome_path; #ifndef OFFICIAL_BUILD // For development mode, chrome.exe should be in same dir as the stub. @@ -176,7 +176,7 @@ FilePath GetAnyChromePath() { return chrome_path; } -FilePath GetAnyAppHostPath() { +base::FilePath GetAnyAppHostPath() { base::FilePath app_host_path; #ifndef OFFICIAL_BUILD // For development mode, app_host.exe should be in same dir as chrome.exe. diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index e21d6e5..cc76b0e 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -62,7 +62,7 @@ bool ScheduleFileSystemEntityForDeletion(const wchar_t* path) { } DWORD flags = MOVEFILE_DELAY_UNTIL_REBOOT; - if (!file_util::DirectoryExists(FilePath::FromWStringHack(path))) { + if (!file_util::DirectoryExists(base::FilePath::FromWStringHack(path))) { // This flag valid only for files flags |= MOVEFILE_REPLACE_EXISTING; } @@ -116,9 +116,9 @@ bool ScheduleDirectoryForDeletion(const wchar_t* dir_name) { // First schedule all the normal files for deletion. { bool success = true; - file_util::FileEnumerator file_enum(FilePath(dir_name), false, + file_util::FileEnumerator file_enum(base::FilePath(dir_name), false, file_util::FileEnumerator::FILES); - for (FilePath file = file_enum.Next(); !file.empty(); + for (base::FilePath file = file_enum.Next(); !file.empty(); file = file_enum.Next()) { success = ScheduleFileSystemEntityForDeletion(file.value().c_str()); if (!success) { @@ -131,9 +131,9 @@ bool ScheduleDirectoryForDeletion(const wchar_t* dir_name) { // Then recurse to all the subdirectories. { bool success = true; - file_util::FileEnumerator dir_enum(FilePath(dir_name), false, + file_util::FileEnumerator dir_enum(base::FilePath(dir_name), false, file_util::FileEnumerator::DIRECTORIES); - for (FilePath sub_dir = dir_enum.Next(); !sub_dir.empty(); + for (base::FilePath sub_dir = dir_enum.Next(); !sub_dir.empty(); sub_dir = dir_enum.Next()) { success = ScheduleDirectoryForDeletion(sub_dir.value().c_str()); if (!success) { diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc index 5df9bae..2fafe6f 100644 --- a/cloud_print/service/win/chrome_launcher.cc +++ b/cloud_print/service/win/chrome_launcher.cc @@ -51,7 +51,7 @@ bool LaunchProcess(const CommandLine& cmdline, } // namespace -ChromeLauncher::ChromeLauncher(const FilePath& user_data) +ChromeLauncher::ChromeLauncher(const base::FilePath& user_data) : stop_event_(true, true), user_data_(user_data) { } @@ -78,7 +78,7 @@ void ChromeLauncher::Run() { for (base::TimeDelta time_out = default_time_out;; time_out = std::min(time_out * 2, max_time_out)) { - FilePath chrome_path = chrome_launcher_support::GetAnyChromePath(); + base::FilePath chrome_path = chrome_launcher_support::GetAnyChromePath(); if (!chrome_path.empty()) { CommandLine cmd(chrome_path); diff --git a/cloud_print/service/win/chrome_launcher.h b/cloud_print/service/win/chrome_launcher.h index bc257ff..322e21f 100644 --- a/cloud_print/service/win/chrome_launcher.h +++ b/cloud_print/service/win/chrome_launcher.h @@ -14,7 +14,7 @@ class ChromeLauncher : public base::DelegateSimpleThread::Delegate { public: - explicit ChromeLauncher(const FilePath& user_data); + explicit ChromeLauncher(const base::FilePath& user_data); virtual ~ChromeLauncher(); @@ -24,7 +24,7 @@ class ChromeLauncher : public base::DelegateSimpleThread::Delegate { virtual void Run() OVERRIDE; private: - FilePath user_data_; + base::FilePath user_data_; base::WaitableEvent stop_event_; scoped_ptr<base::DelegateSimpleThread> thread_; diff --git a/cloud_print/service/win/cloud_print_service.cc b/cloud_print/service/win/cloud_print_service.cc index 3d1e7f0..b4a2ae6 100644 --- a/cloud_print/service/win/cloud_print_service.cc +++ b/cloud_print/service/win/cloud_print_service.cc @@ -68,7 +68,7 @@ HRESULT HResultFromLastError() { } void InvalidUsage() { - FilePath service_path; + base::FilePath service_path; CHECK(PathService::Get(base::FILE_EXE, &service_path)); std::cout << "Usage: "; @@ -193,7 +193,7 @@ class CloudPrintServiceModule if (FAILED(hr)) return hr; - FilePath service_path; + base::FilePath service_path; CHECK(PathService::Get(base::FILE_EXE, &service_path)); CommandLine command_line(service_path); command_line.AppendSwitch(run_switch); @@ -346,7 +346,7 @@ class CloudPrintServiceModule WideToASCII(*run_as_user), false)); *run_as_password = ASCIIToWide(GetOption("Password", "", true)); - FilePath requirements_filename(user_data_dir_); + base::FilePath requirements_filename(user_data_dir_); requirements_filename = requirements_filename.Append(kRequirementsFileName); @@ -389,7 +389,7 @@ class CloudPrintServiceModule } HRESULT SetupServiceState() { - FilePath file = user_data_dir_.Append(kServiceStateFileName); + base::FilePath file = user_data_dir_.Append(kServiceStateFileName); for (;;) { std::string contents; @@ -492,7 +492,7 @@ class CloudPrintServiceModule } HRESULT CheckRequirements() { - FilePath requirements_filename(user_data_dir_); + base::FilePath requirements_filename(user_data_dir_); requirements_filename = requirements_filename.Append(kRequirementsFileName); std::string output; output.append("Printers available for " + @@ -506,7 +506,7 @@ class CloudPrintServiceModule output += printer_list[i].printer_name; output += "\n"; } - FilePath chrome = chrome_launcher_support::GetAnyChromePath(); + base::FilePath chrome = chrome_launcher_support::GetAnyChromePath(); output.append(chrome.empty() ? kChromeIsNotAvalible : kChromeIsAvalible); file_util::WriteFile(requirements_filename, output.c_str(), output.size()); return S_OK; @@ -527,7 +527,7 @@ class CloudPrintServiceModule static BOOL WINAPI ConsoleCtrlHandler(DWORD type); bool check_requirements_; - FilePath user_data_dir_; + base::FilePath user_data_dir_; scoped_ptr<ChromeLauncher> chrome_; }; diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc index 3583132..1448671 100644 --- a/cloud_print/virtual_driver/win/install/setup.cc +++ b/cloud_print/virtual_driver/win/install/setup.cc @@ -87,8 +87,8 @@ void DeleteGoogleUpdateKeys() { } } -FilePath GetSystemPath(const string16& binary) { - FilePath path; +base::FilePath GetSystemPath(const string16& binary) { + base::FilePath path; if (!PathService::Get(base::DIR_SYSTEM, &path)) { LOG(ERROR) << "Unable to get system path."; return path; @@ -96,10 +96,10 @@ FilePath GetSystemPath(const string16& binary) { return path.Append(binary); } -FilePath GetNativeSystemPath(const string16& binary) { +base::FilePath GetNativeSystemPath(const string16& binary) { if (!cloud_print::IsSystem64Bit()) return GetSystemPath(binary); - FilePath path; + base::FilePath path; // Sysnative will bypass filesystem redirection and give us // the location of the 64bit system32 from a 32 bit process. if (!PathService::Get(base::DIR_WINDOWS, &path)) { @@ -110,7 +110,7 @@ FilePath GetNativeSystemPath(const string16& binary) { } void SpoolerServiceCommand(const char* command) { - FilePath net_path = GetNativeSystemPath(L"net"); + base::FilePath net_path = GetNativeSystemPath(L"net"); if (net_path.empty()) return; CommandLine command_line(net_path); @@ -125,16 +125,16 @@ void SpoolerServiceCommand(const char* command) { base::LaunchProcess(command_line, options, NULL); } -HRESULT RegisterPortMonitor(bool install, const FilePath& install_path) { +HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) { DCHECK(install || install_path.empty()); - FilePath target_path = + base::FilePath target_path = GetNativeSystemPath(cloud_print::GetPortMonitorDllName()); if (target_path.empty()) { LOG(ERROR) << "Unable to get port monitor target path."; return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); } if (install) { - FilePath source_path = + base::FilePath source_path = install_path.Append(cloud_print::GetPortMonitorDllName()); if (!file_util::CopyFile(source_path, target_path)) { LOG(ERROR) << "Unable copy port monitor dll from " << @@ -146,7 +146,7 @@ HRESULT RegisterPortMonitor(bool install, const FilePath& install_path) { return S_OK; } - FilePath regsvr32_path = GetNativeSystemPath(L"regsvr32.exe"); + base::FilePath regsvr32_path = GetNativeSystemPath(L"regsvr32.exe"); if (regsvr32_path.empty()) { LOG(ERROR) << "Can't find regsvr32.exe."; return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); @@ -215,15 +215,15 @@ UINT CALLBACK CabinetCallback(PVOID data, UINT notification, UINT_PTR param1, UINT_PTR param2 ) { - FilePath* temp_path = reinterpret_cast<FilePath*>(data); + base::FilePath* temp_path = reinterpret_cast<base::FilePath*>(data); if (notification == SPFILENOTIFY_FILEINCABINET) { FILE_IN_CABINET_INFO* info = reinterpret_cast<FILE_IN_CABINET_INFO*>(param1); for (int i = 0; i < arraysize(kDependencyList); i++) { - FilePath base_name(info->NameInCabinet); + base::FilePath base_name(info->NameInCabinet); base_name = base_name.BaseName(); - if (FilePath::CompareEqualIgnoreCase(base_name.value().c_str(), - kDependencyList[i])) { + if (base::FilePath::CompareEqualIgnoreCase(base_name.value().c_str(), + kDependencyList[i])) { StringCchCopy(info->FullTargetName, MAX_PATH, temp_path->Append(kDependencyList[i]).value().c_str()); return FILEOP_DOIT; @@ -235,7 +235,7 @@ UINT CALLBACK CabinetCallback(PVOID data, return NO_ERROR; } -void ReadyPpdDependencies(const FilePath& install_path) { +void ReadyPpdDependencies(const base::FilePath& install_path) { base::win::Version version = base::win::GetVersion(); if (version >= base::win::VERSION_VISTA) { // GetCorePrinterDrivers and GetPrinterDriverPackagePath only exist on @@ -259,19 +259,19 @@ void ReadyPpdDependencies(const FilePath& install_path) { SetupIterateCabinet(package_path, 0, CabinetCallback, - const_cast<FilePath*>(&install_path)); + const_cast<base::FilePath*>(&install_path)); } else { // PS driver files are in the sp3 cab. - FilePath package_path; + base::FilePath package_path; PathService::Get(base::DIR_WINDOWS, &package_path); package_path = package_path.Append(L"Driver Cache\\i386\\sp3.cab"); SetupIterateCabinet(package_path.value().c_str(), 0, CabinetCallback, - const_cast<FilePath*>(&install_path)); + const_cast<base::FilePath*>(&install_path)); // The XPS driver files are just sitting uncompressed in the driver cache. - FilePath xps_path; + base::FilePath xps_path; PathService::Get(base::DIR_WINDOWS, &xps_path); xps_path = xps_path.Append(L"Driver Cache\\i386"); xps_path = xps_path.Append(kDriverName); @@ -279,15 +279,15 @@ void ReadyPpdDependencies(const FilePath& install_path) { } } -HRESULT InstallPpd(const FilePath& install_path) { +HRESULT InstallPpd(const base::FilePath& install_path) { DRIVER_INFO_6 driver_info = {0}; HRESULT result = S_OK; // Set up paths for the files we depend on. - FilePath ppd_path = install_path.Append(kPpdName); - FilePath xps_path = install_path.Append(kDriverName); - FilePath ui_path = install_path.Append(kUiDriverName); - FilePath ui_help_path = install_path.Append(kHelpName); + base::FilePath ppd_path = install_path.Append(kPpdName); + base::FilePath xps_path = install_path.Append(kDriverName); + base::FilePath ui_path = install_path.Append(kUiDriverName); + base::FilePath ui_help_path = install_path.Append(kHelpName); ReadyPpdDependencies(install_path); // None of the print API structures likes constant strings even though they // don't modify the string. const_casting is the cleanest option. @@ -390,7 +390,7 @@ HRESULT UninstallPrinter(void) { return S_OK; } -void SetupUninstall(const FilePath& install_path) { +void SetupUninstall(const base::FilePath& install_path) { // Now write the Windows Uninstall entries // Minimal error checking here since the install can contiunue // if this fails. @@ -438,7 +438,7 @@ bool IsOSSupported() { (base::win::OSInfo::GetInstance()->service_pack().major >= 3)); } -HRESULT RegisterVirtualDriver(const FilePath& install_path) { +HRESULT RegisterVirtualDriver(const base::FilePath& install_path) { HRESULT result = S_OK; DCHECK(file_util::DirectoryExists(install_path)); @@ -468,17 +468,17 @@ HRESULT RegisterVirtualDriver(const FilePath& install_path) { return S_OK; } -void GetCurrentInstallPath(FilePath* install_path) { +void GetCurrentInstallPath(base::FilePath* install_path) { base::win::RegKey key; if (key.Open(HKEY_LOCAL_MACHINE, kUninstallRegistry, KEY_QUERY_VALUE) != ERROR_SUCCESS) { // Not installed. - *install_path = FilePath(); + *install_path = base::FilePath(); return; } string16 install_path_value; key.ReadValue(L"InstallLocation", &install_path_value); - *install_path = FilePath(install_path_value); + *install_path = base::FilePath(install_path_value); } HRESULT TryUnregisterVirtualDriver() { @@ -494,7 +494,7 @@ HRESULT TryUnregisterVirtualDriver() { return result; } // The second argument is ignored if the first is false. - result = RegisterPortMonitor(false, FilePath()); + result = RegisterPortMonitor(false, base::FilePath()); if (FAILED(result)) { LOG(ERROR) << "Unable to remove port monitor."; return result; @@ -516,8 +516,8 @@ HRESULT UnregisterVirtualDriver() { return hr; } -HRESULT DeleteProgramDir(const FilePath& installer_source, bool wait) { - FilePath temp_path; +HRESULT DeleteProgramDir(const base::FilePath& installer_source, bool wait) { + base::FilePath temp_path; if (file_util::CreateTemporaryFile(&temp_path)) { file_util::CopyFile(installer_source, temp_path); file_util::DeleteAfterReboot(temp_path); @@ -551,7 +551,7 @@ HRESULT DoUninstall() { if (FAILED(result)) return result; CleanupUninstall(); - FilePath installer_source; + base::FilePath installer_source; if (PathService::Get(base::FILE_EXE, &installer_source)) return DeleteProgramDir(installer_source, false); return S_OK; @@ -561,14 +561,14 @@ HRESULT DoUnregister() { return UnregisterVirtualDriver(); } -HRESULT DoRegister(const FilePath& install_path) { +HRESULT DoRegister(const base::FilePath& install_path) { HRESULT result = UnregisterVirtualDriver(); if (FAILED(result)) return result; return RegisterVirtualDriver(install_path); } -HRESULT DoDelete(const FilePath& install_path) { +HRESULT DoDelete(const base::FilePath& install_path) { if (install_path.value().empty()) return E_INVALIDARG; if (!file_util::DirectoryExists(install_path)) @@ -577,13 +577,13 @@ HRESULT DoDelete(const FilePath& install_path) { return file_util::Delete(install_path, true) ? S_OK : E_FAIL; } -HRESULT DoInstall(const FilePath& install_path) { +HRESULT DoInstall(const base::FilePath& install_path) { HRESULT result = UnregisterVirtualDriver(); if (FAILED(result)) { LOG(ERROR) << "Unable to unregister."; return result; } - FilePath old_install_path; + base::FilePath old_install_path; GetCurrentInstallPath(&old_install_path); if (!old_install_path.value().empty() && install_path != old_install_path) { @@ -601,7 +601,7 @@ HRESULT DoInstall(const FilePath& install_path) { HRESULT ExecuteCommands() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - FilePath exe_path; + base::FilePath exe_path; if (FAILED(PathService::Get(base::DIR_EXE, &exe_path)) || !file_util::DirectoryExists(exe_path)) { return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc index 34884e4..e833145 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -67,7 +67,7 @@ struct PortData { DWORD job_id; HANDLE printer_handle; FILE* file; - FilePath file_path; + base::FilePath file_path; }; typedef struct { @@ -104,21 +104,21 @@ MONITOR2 g_monitor_2 = { Monitor2Shutdown }; -FilePath GetAppDataDir() { - FilePath file_path; +base::FilePath GetAppDataDir() { + base::FilePath file_path; if (!PathService::Get(base::DIR_LOCAL_APP_DATA_LOW, &file_path)) { LOG(ERROR) << "Can't get DIR_LOCAL_APP_DATA_LOW"; - return FilePath(); + return base::FilePath(); } return file_path.Append(kAppDataDir); } // Delete files which where not deleted by chrome. -void DeleteLeakedFiles(const FilePath& dir) { +void DeleteLeakedFiles(const base::FilePath& dir) { using file_util::FileEnumerator; base::Time delete_before = base::Time::Now() - base::TimeDelta::FromDays(1); FileEnumerator enumerator(dir, false, FileEnumerator::FILES); - for (FilePath file_path = enumerator.Next(); !file_path.empty(); + for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); file_path = enumerator.Next()) { FileEnumerator::FindInfo info; enumerator.GetFindInfo(&info); @@ -193,7 +193,7 @@ bool GetUserToken(HANDLE* primary_token) { // Launches the Cloud Print dialog in Chrome. // xps_path references a file to print. // job_title is the title to be used for the resulting print job. -bool LaunchPrintDialog(const FilePath& xps_path, +bool LaunchPrintDialog(const base::FilePath& xps_path, const string16& job_title) { HANDLE token = NULL; if (!GetUserToken(&token)) { @@ -202,7 +202,7 @@ bool LaunchPrintDialog(const FilePath& xps_path, } base::win::ScopedHandle primary_token_scoped(token); - FilePath chrome_path = GetChromeExePath(); + base::FilePath chrome_path = GetChromeExePath(); if (chrome_path.empty()) { LOG(ERROR) << "Unable to get chrome exe path."; return false; @@ -210,7 +210,7 @@ bool LaunchPrintDialog(const FilePath& xps_path, CommandLine command_line(chrome_path); - FilePath chrome_profile = GetChromeProfilePath(); + base::FilePath chrome_profile = GetChromeProfilePath(); if (!chrome_profile.empty()) { command_line.AppendSwitchPath(switches::kCloudPrintUserDataDir, chrome_profile); @@ -243,7 +243,7 @@ void LaunchChromeDownloadPage() { } base::win::ScopedHandle token_scoped(token); - FilePath ie_path; + base::FilePath ie_path; PathService::Get(base::DIR_PROGRAM_FILESX86, &ie_path); ie_path = ie_path.Append(kIePath); CommandLine command_line(ie_path); @@ -283,35 +283,35 @@ bool ValidateCurrentUser() { } } // namespace -FilePath ReadPathFromRegistry(HKEY root, const wchar_t* path_name) { +base::FilePath ReadPathFromRegistry(HKEY root, const wchar_t* path_name) { base::win::RegKey gcp_key(HKEY_CURRENT_USER, kCloudPrintRegKey, KEY_READ); string16 data; if (SUCCEEDED(gcp_key.ReadValue(path_name, &data)) && - file_util::PathExists(FilePath(data))) { - return FilePath(data); + file_util::PathExists(base::FilePath(data))) { + return base::FilePath(data); } - return FilePath(); + return base::FilePath(); } -FilePath ReadPathFromAnyRegistry(const wchar_t* path_name) { - FilePath result = ReadPathFromRegistry(HKEY_CURRENT_USER, path_name); +base::FilePath ReadPathFromAnyRegistry(const wchar_t* path_name) { + base::FilePath result = ReadPathFromRegistry(HKEY_CURRENT_USER, path_name); if (!result.empty()) return result; return ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path_name); } -FilePath GetChromeExePath() { - FilePath path = ReadPathFromAnyRegistry(kChromeExePathRegValue); +base::FilePath GetChromeExePath() { + base::FilePath path = ReadPathFromAnyRegistry(kChromeExePathRegValue); if (!path.empty()) return path; return chrome_launcher_support::GetAnyChromePath(); } -FilePath GetChromeProfilePath() { - FilePath path = ReadPathFromAnyRegistry(kChromeProfilePathRegValue); +base::FilePath GetChromeProfilePath() { + base::FilePath path = ReadPathFromAnyRegistry(kChromeProfilePathRegValue); if (!path.empty() && file_util::DirectoryExists(path)) return path; - return FilePath(); + return base::FilePath(); } BOOL WINAPI Monitor2EnumPorts(HANDLE, @@ -437,8 +437,8 @@ BOOL WINAPI Monitor2StartDocPort(HANDLE port_handle, // This is the normal flow during a unit test. port_data->printer_handle = NULL; } - FilePath& file_path = port_data->file_path; - FilePath app_data_dir = GetAppDataDir(); + base::FilePath& file_path = port_data->file_path; + base::FilePath app_data_dir = GetAppDataDir(); if (app_data_dir.empty()) return FALSE; DeleteLeakedFiles(app_data_dir); @@ -586,7 +586,7 @@ DWORD WINAPI Monitor2XcvDataPort(HANDLE xcv_handle, // dynamic creation of ports. if (lstrcmp(L"MonitorUI", data_name) == 0) { DWORD dll_path_len = 0; - FilePath dll_path(GetPortMonitorDllName()); + base::FilePath dll_path(GetPortMonitorDllName()); dll_path_len = static_cast<DWORD>(dll_path.value().length()); if (output_data_bytes_needed != NULL) { *output_data_bytes_needed = dll_path_len; diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.h b/cloud_print/virtual_driver/win/port_monitor/port_monitor.h index b26999f..3e21f88 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.h +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.h @@ -14,10 +14,10 @@ namespace cloud_print { // Returns path to be used for launching Chrome. -FilePath GetChromeExePath(); +base::FilePath GetChromeExePath(); // Returns path to user profile to be used for launching Chrome. -FilePath GetChromeProfilePath(); +base::FilePath GetChromeProfilePath(); // Implementations for the function pointers in the MONITOR2 structure // returned by InitializePrintMonitor2. The prototypes and behaviors diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc index c6acfda..e9cf3b5 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc @@ -39,7 +39,7 @@ namespace { // Returns true if Xps support is installed. bool XpsIsInstalled() { - FilePath xps_path; + base::FilePath xps_path; if (!SUCCEEDED(GetPrinterDriverDir(&xps_path))) { return false; } @@ -80,7 +80,7 @@ HRESULT WINAPI DllRegisterServer(void) { MONITOR_INFO_2 monitor_info = {0}; // YUCK!!! I can either copy the constant, const_cast, or define my own // MONITOR_INFO_2 that will take const strings. - FilePath dll_path(cloud_print::GetPortMonitorDllName()); + base::FilePath dll_path(cloud_print::GetPortMonitorDllName()); monitor_info.pDLLName = const_cast<LPWSTR>(dll_path.value().c_str()); monitor_info.pName = const_cast<LPWSTR>(dll_path.value().c_str()); if (AddMonitor(NULL, 2, reinterpret_cast<BYTE*>(&monitor_info))) { @@ -94,7 +94,7 @@ HRESULT WINAPI DllUnregisterServer(void) { if (!cloud_print::CanRegister()) { return E_ACCESSDENIED; } - FilePath dll_path(cloud_print::GetPortMonitorDllName()); + base::FilePath dll_path(cloud_print::GetPortMonitorDllName()); if (DeleteMonitor(NULL, NULL, const_cast<LPWSTR>(dll_path.value().c_str()))) { diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc index 15bac4b..cc935bf 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc @@ -39,13 +39,13 @@ class PortMonitorTest : public testing::Test { cloud_print::kCloudPrintRegKey, KEY_ALL_ACCESS); - FilePath path; + base::FilePath path; PathService::Get(base::DIR_LOCAL_APP_DATA, &path); path = path.Append(kAlternateChromeExePath); ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(cloud_print::kChromeExePathRegValue, path.value().c_str())); - FilePath temp; + base::FilePath temp; PathService::Get(base::DIR_TEMP, &temp); // Write any dir here. ASSERT_EQ(ERROR_SUCCESS, @@ -62,21 +62,21 @@ class PortMonitorTest : public testing::Test { } virtual void CreateTempChromeExeFiles() { - FilePath path; + base::FilePath path; PathService::Get(base::DIR_LOCAL_APP_DATA, &path); - FilePath main_path = path.Append(kChromeExePath); + base::FilePath main_path = path.Append(kChromeExePath); ASSERT_TRUE(file_util::CreateDirectory(main_path)); - FilePath alternate_path = path.Append(kAlternateChromeExePath); + base::FilePath alternate_path = path.Append(kAlternateChromeExePath); ASSERT_TRUE(file_util::CreateDirectory(alternate_path)); } virtual void DeleteTempChromeExeFiles() { - FilePath path; + base::FilePath path; PathService::Get(base::DIR_LOCAL_APP_DATA, &path); - FilePath main_path = path.Append(kChromeExePath); + base::FilePath main_path = path.Append(kChromeExePath); ASSERT_TRUE(file_util::Delete(main_path, true)); PathService::Get(base::DIR_LOCAL_APP_DATA, &path); - FilePath alternate_path = path.Append(kAlternateChromeExePath); + base::FilePath alternate_path = path.Append(kAlternateChromeExePath); ASSERT_TRUE(file_util::Delete(alternate_path, true)); } @@ -95,7 +95,7 @@ class PortMonitorTest : public testing::Test { TEST_F(PortMonitorTest, GetChromeExePathTest) { CreateTempChromeExeFiles(); - FilePath chrome_path = cloud_print::GetChromeExePath(); + base::FilePath chrome_path = cloud_print::GetChromeExePath(); EXPECT_FALSE(chrome_path.empty()); EXPECT_TRUE( chrome_path.value().rfind(kAlternateChromeExePath) != std::string::npos); @@ -108,9 +108,9 @@ TEST_F(PortMonitorTest, GetChromeExePathTest) { } TEST_F(PortMonitorTest, GetChromeProfilePathTest) { - FilePath data_path = cloud_print::GetChromeProfilePath(); + base::FilePath data_path = cloud_print::GetChromeProfilePath(); EXPECT_FALSE(data_path.empty()); - FilePath temp; + base::FilePath temp; PathService::Get(base::DIR_TEMP, &temp); EXPECT_EQ(data_path, temp); EXPECT_TRUE(file_util::DirectoryExists(data_path)); diff --git a/cloud_print/virtual_driver/win/virtual_driver_helpers.cc b/cloud_print/virtual_driver/win/virtual_driver_helpers.cc index 27c30bf..c331ff8 100644 --- a/cloud_print/virtual_driver/win/virtual_driver_helpers.cc +++ b/cloud_print/virtual_driver/win/virtual_driver_helpers.cc @@ -42,7 +42,7 @@ string16 GetPortMonitorDllName() { } } -HRESULT GetPrinterDriverDir(FilePath* path) { +HRESULT GetPrinterDriverDir(base::FilePath* path) { BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)]; DWORD needed = 0; if (!GetPrinterDriverDirectory(NULL, @@ -55,7 +55,7 @@ HRESULT GetPrinterDriverDir(FilePath* path) { // but that really shouldn't happen. return cloud_print::GetLastHResult(); } - *path = FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer)); + *path = base::FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer)); // The XPS driver is a "Level 3" driver *path = path->Append(L"3"); diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc index 506e098..ca081a0 100644 --- a/content/gpu/gpu_info_collector_win.cc +++ b/content/gpu/gpu_info_collector_win.cc @@ -212,7 +212,7 @@ void CollectD3D11Support() { FeatureLevel feature_level = FEATURE_LEVEL_UNKNOWN; UINT bgra_support = 0; - base::ScopedNativeLibrary module(FilePath(L"d3d11.dll")); + base::ScopedNativeLibrary module(base::FilePath(L"d3d11.dll")); if (!module.is_valid()) { feature_level = FEATURE_LEVEL_NO_D3D11_DLL; } else { diff --git a/net/android/keystore_unittest.cc b/net/android/keystore_unittest.cc index b4c0504..46492c2 100644 --- a/net/android/keystore_unittest.cc +++ b/net/android/keystore_unittest.cc @@ -115,8 +115,8 @@ unsigned char* OpenSSLWriteInto(std::string* str, size_t size) { // Returns a new EVP_PKEY on success, NULL on failure. EVP_PKEY* ImportPrivateKeyFile(const char* filename) { // Load file in memory. - FilePath certs_dir = GetTestCertsDirectory(); - FilePath file_path = certs_dir.AppendASCII(filename); + base::FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath file_path = certs_dir.AppendASCII(filename); ScopedStdioHandle handle( file_util::OpenFile(file_path, "rb")); if (!handle.get()) { @@ -165,8 +165,8 @@ bool ImportPrivateKeyFileAsPkcs8(const char* filename, // Same as ImportPrivateKey, but for public ones. EVP_PKEY* ImportPublicKeyFile(const char* filename) { // Load file as PEM data. - FilePath certs_dir = GetTestCertsDirectory(); - FilePath file_path = certs_dir.AppendASCII(filename); + base::FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath file_path = certs_dir.AppendASCII(filename); ScopedStdioHandle handle(file_util::OpenFile(file_path, "rb")); if (!handle.get()) { LOG(ERROR) << "Could not open public key file: " << filename; diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc index 68bb5d1..a16b536 100644 --- a/testing/android/native_test_launcher.cc +++ b/testing/android/native_test_launcher.cc @@ -109,25 +109,26 @@ static void RunTests(JNIEnv* env, CommandLine(argc, &argv[0]), false); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - FilePath files_dir(base::android::ConvertJavaStringToUTF8(env, jfiles_dir)); + base::FilePath files_dir( + base::android::ConvertJavaStringToUTF8(env, jfiles_dir)); // A few options, such "--gtest_list_tests", will just use printf directly // Always redirect stdout to a known file. - FilePath fifo_path(files_dir.Append(FilePath("test.fifo"))); + base::FilePath fifo_path(files_dir.Append(base::FilePath("test.fifo"))); CreateFIFO(fifo_path.value().c_str()); - FilePath stderr_fifo_path, stdin_fifo_path; + base::FilePath stderr_fifo_path, stdin_fifo_path; // DumpRenderTree needs a separate fifo for the stderr output. For all // other tests, insert stderr content to the same fifo we use for stdout. if (command_line.HasSwitch(kSeparateStderrFifo)) { - stderr_fifo_path = files_dir.Append(FilePath("stderr.fifo")); + stderr_fifo_path = files_dir.Append(base::FilePath("stderr.fifo")); CreateFIFO(stderr_fifo_path.value().c_str()); } // DumpRenderTree uses stdin to receive input about which test to run. if (command_line.HasSwitch(kCreateStdinFifo)) { - stdin_fifo_path = files_dir.Append(FilePath("stdin.fifo")); + stdin_fifo_path = files_dir.Append(base::FilePath("stdin.fifo")); CreateFIFO(stdin_fifo_path.value().c_str()); } diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc index 33fd2d9..2c2f123 100644 --- a/webkit/media/android/webmediaplayer_android.cc +++ b/webkit/media/android/webmediaplayer_android.cc @@ -146,7 +146,7 @@ bool WebMediaPlayerAndroid::hasVideo() const { if (!url_.has_path()) return false; std::string mime; - if(!net::GetMimeTypeFromFile(FilePath(url_.path()), &mime)) + if(!net::GetMimeTypeFromFile(base::FilePath(url_.path()), &mime)) return true; return mime.find("audio/") == std::string::npos; } diff --git a/win8/test/metro_registration_helper.cc b/win8/test/metro_registration_helper.cc index 79e19d4..97442a8 100644 --- a/win8/test/metro_registration_helper.cc +++ b/win8/test/metro_registration_helper.cc @@ -28,12 +28,12 @@ namespace win8 { bool RegisterTestDefaultBrowser(const string16& app_user_model_id, const string16& viewer_process_name) { - FilePath dir; + base::FilePath dir; if (!PathService::Get(base::DIR_EXE, &dir)) return false; - FilePath chrome_exe(dir.Append(kChromeExe)); - FilePath registrar(dir.Append(kRegistrar)); + base::FilePath chrome_exe(dir.Append(kChromeExe)); + base::FilePath registrar(dir.Append(kRegistrar)); if (!file_util::PathExists(chrome_exe) || !file_util::PathExists(registrar)) { LOG(ERROR) << "Could not locate " << kChromeExe << " or " << kRegistrar; |