diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-10 03:41:45 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-10 03:41:45 +0000 |
commit | 650b2d5cdcab7d2c473c00d15b9f343f3a3405bb (patch) | |
tree | 1343ea25d7d6086ac1279e1e0e32562b3b9b3477 /chrome/browser/web_applications | |
parent | 6f3638708ff440a2e80662ce49acc41cdad51ecd (diff) | |
download | chromium_src-650b2d5cdcab7d2c473c00d15b9f343f3a3405bb.zip chromium_src-650b2d5cdcab7d2c473c00d15b9f343f3a3405bb.tar.gz chromium_src-650b2d5cdcab7d2c473c00d15b9f343f3a3405bb.tar.bz2 |
Merge branch 'master' into file_path_browser
version control markers
Merge branch 'master' into file_path_browser
remove version control
Fix typo
Merge branch 'master' into file_path_browser
Conflicts:
chrome/browser/intents/native_services_browsertest.cc
chrome/browser/ui/intents/native_file_picker_service.cc
Merge branch 'master' into file_path_browser
Conflicts:
chrome/browser/chromeos/drive/drive_file_system.cc
chrome/browser/chromeos/drive/drive_file_system.h
chrome/browser/chromeos/drive/drive_file_system_interface.h
chrome/browser/chromeos/drive/drive_file_system_unittest.cc
chrome/browser/chromeos/drive/file_system/drive_operations.cc
chrome/browser/chromeos/login/wallpaper_manager.cc
chrome/browser/chromeos/login/wallpaper_manager.h
chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc
chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc
chrome/browser/google_apis/gdata_wapi_operations.cc
chrome/browser/google_apis/gdata_wapi_operations.h
chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
chrome/browser/profiles/off_the_record_profile_impl.cc
chrome/browser/profiles/off_the_record_profile_impl.h
chrome/browser/profiles/profile_impl.cc
chrome/browser/profiles/profile_impl.h
chrome/browser/profiles/profile_impl_io_data.cc
chrome/browser/profiles/profile_impl_io_data.h
chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc
chrome/browser/ui/webui/options/manage_profile_handler.cc
Long lines
long lines
some long lines.
long lines
long lines
Beginning of lines.
Rename FilePath -> base::FilePath in chrome/browser
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_applications')
-rw-r--r-- | chrome/browser/web_applications/web_app.cc | 30 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app.h | 20 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_android.cc | 6 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_linux.cc | 6 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac.h | 15 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac.mm | 37 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac_unittest.mm | 29 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_unittest.cc | 13 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.cc | 72 |
9 files changed, 118 insertions, 110 deletions
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index aa89513..4af6705 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -33,7 +33,7 @@ void DeleteShortcutsOnFileThread( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( + base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, GURL()); return web_app::internals::DeletePlatformShortcuts( shortcut_data_dir, shortcut_info); @@ -43,7 +43,7 @@ void UpdateShortcutsOnFileThread( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( + base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, GURL()); return web_app::internals::UpdatePlatformShortcuts( shortcut_data_dir, shortcut_info); @@ -63,23 +63,23 @@ static const char* kCrxAppPrefix = "_crx_"; namespace internals { -FilePath GetSanitizedFileName(const string16& name) { +base::FilePath GetSanitizedFileName(const string16& name) { #if defined(OS_WIN) string16 file_name = name; #else std::string file_name = UTF16ToUTF8(name); #endif file_util::ReplaceIllegalCharactersInPath(&file_name, '_'); - return FilePath(file_name); + return base::FilePath(file_name); } } // namespace internals -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const std::string& extension_id, - const GURL& url) { +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const std::string& extension_id, + const GURL& url) { DCHECK(!profile_path.empty()); - FilePath app_data_dir(profile_path.Append(chrome::kWebAppDirname)); + base::FilePath app_data_dir(profile_path.Append(chrome::kWebAppDirname)); if (!extension_id.empty()) { return app_data_dir.AppendASCII( @@ -92,18 +92,18 @@ FilePath GetWebAppDataDirectory(const FilePath& profile_path, std::string scheme_port(scheme + "_" + port); #if defined(OS_WIN) - FilePath::StringType host_path(UTF8ToUTF16(host)); - FilePath::StringType scheme_port_path(UTF8ToUTF16(scheme_port)); + base::FilePath::StringType host_path(UTF8ToUTF16(host)); + base::FilePath::StringType scheme_port_path(UTF8ToUTF16(scheme_port)); #elif defined(OS_POSIX) - FilePath::StringType host_path(host); - FilePath::StringType scheme_port_path(scheme_port); + base::FilePath::StringType host_path(host); + base::FilePath::StringType scheme_port_path(scheme_port); #endif return app_data_dir.Append(host_path).Append(scheme_port_path); } -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const extensions::Extension& extension) { +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const extensions::Extension& extension) { return GetWebAppDataDirectory( profile_path, extension.id(), GURL(extension.launch_web_url())); } @@ -172,7 +172,7 @@ bool CreateShortcutsOnFileThread( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_data_dir = GetWebAppDataDirectory( + base::FilePath shortcut_data_dir = GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, shortcut_info.url); return internals::CreatePlatformShortcuts(shortcut_data_dir, shortcut_info); diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index 56b6612..deab896 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -22,14 +22,14 @@ namespace web_app { // Gets the user data directory for given web app. The path for the directory is // based on |extension_id|. If |extension_id| is empty then |url| is used // to construct a unique ID. -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const std::string& extension_id, - const GURL& url); +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const std::string& extension_id, + const GURL& url); // Gets the user data directory to use for |extension| located inside // |profile_path|. -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const extensions::Extension& extension); +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const extensions::Extension& extension); // Compute a deterministic name based on data in the shortcut_info. std::string GenerateApplicationNameFromInfo( @@ -85,7 +85,7 @@ std::string GetWMClassFromAppName(std::string app_name); namespace internals { #if defined(OS_WIN) -bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image); +bool CheckAndSaveIcon(const base::FilePath& icon_file, const SkBitmap& image); #endif // Implemented for each platform, does the platform specific parts of creating @@ -94,26 +94,26 @@ bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image); // shortcut, and is also used as the UserDataDir for platform app shortcuts. // |shortcut_info| contains info about the shortcut to create. bool CreatePlatformShortcuts( - const FilePath& shortcut_data_path, + const base::FilePath& shortcut_data_path, const ShellIntegration::ShortcutInfo& shortcut_info); // Delete all the shortcuts we have added for this extension. This is the // platform specific implementation of the DeleteAllShortcuts function, and // is executed on the FILE thread. void DeletePlatformShortcuts( - const FilePath& shortcut_data_path, + const base::FilePath& shortcut_data_path, const ShellIntegration::ShortcutInfo& shortcut_info); // Updates all the shortcuts we have added for this extension. This is the // platform specific implementation of the UpdateAllShortcuts function, and // is executed on the FILE thread. void UpdatePlatformShortcuts( - const FilePath& shortcut_data_path, + const base::FilePath& shortcut_data_path, const ShellIntegration::ShortcutInfo& shortcut_info); // Sanitizes |name| and returns a version of it that is safe to use as an // on-disk file name . -FilePath GetSanitizedFileName(const string16& name); +base::FilePath GetSanitizedFileName(const string16& name); } // namespace internals diff --git a/chrome/browser/web_applications/web_app_android.cc b/chrome/browser/web_applications/web_app_android.cc index 2008ece..b6ff730 100644 --- a/chrome/browser/web_applications/web_app_android.cc +++ b/chrome/browser/web_applications/web_app_android.cc @@ -8,17 +8,17 @@ namespace web_app { namespace internals { bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { return true; } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) {} void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) {} } // namespace internals diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc index 18ac835..325911f 100644 --- a/chrome/browser/web_applications/web_app_linux.cc +++ b/chrome/browser/web_applications/web_app_linux.cc @@ -14,7 +14,7 @@ namespace web_app { namespace internals { bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); @@ -30,14 +30,14 @@ bool CreatePlatformShortcuts( } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, shortcut_info.extension_id); } void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // TODO(benwells): Implement this. } diff --git a/chrome/browser/web_applications/web_app_mac.h b/chrome/browser/web_applications/web_app_mac.h index 94331c4..5e06cdc 100644 --- a/chrome/browser/web_applications/web_app_mac.h +++ b/chrome/browser/web_applications/web_app_mac.h @@ -28,7 +28,7 @@ class WebAppShortcutCreator { // The shortcut stores its user data directory in |user_data_dir|. // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. WebAppShortcutCreator( - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, const ShellIntegration::ShortcutInfo& shortcut_info, const string16& chrome_bundle_id); @@ -40,16 +40,17 @@ class WebAppShortcutCreator { protected: // Returns a path to the app loader. - FilePath GetAppLoaderPath() const; + base::FilePath GetAppLoaderPath() const; // Returns a path to the destination where the app should be written to. - virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; + virtual base::FilePath GetDestinationPath( + const base::FilePath& app_file_name) const; // Updates the plist inside |app_path| with information about the app. - bool UpdatePlist(const FilePath& app_path) const; + bool UpdatePlist(const base::FilePath& app_path) const; // Updates the icon for the shortcut. - bool UpdateIcon(const FilePath& app_path) const; + bool UpdateIcon(const base::FilePath& app_path) const; private: FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateIcon); @@ -57,7 +58,7 @@ class WebAppShortcutCreator { // Path to the app's user data directory. For example: // ~/Library/Application Support/Chromium/Default/Web Applications/_crx_abc/ // Note, the user data directory is the parent of the profile directory. - FilePath user_data_dir_; + base::FilePath user_data_dir_; // Returns the bundle identifier to use for this app bundle. // |plist| is a dictionary containg a copy of the template plist file to @@ -66,7 +67,7 @@ class WebAppShortcutCreator { // Show the bundle we just generated in the Finder. virtual void RevealGeneratedBundleInFinder( - const FilePath& generated_bundle) const; + const base::FilePath& generated_bundle) const; // Information about the app. ShellIntegration::ShortcutInfo info_; diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index be02bc5..3e0e41e 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -84,7 +84,7 @@ bool AddBitmapImageRepToIconFamily(IconFamily* icon_family, namespace web_app { WebAppShortcutCreator::WebAppShortcutCreator( - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, const ShellIntegration::ShortcutInfo& shortcut_info, const string16& chrome_bundle_id) : user_data_dir_(user_data_dir), @@ -96,12 +96,12 @@ WebAppShortcutCreator::~WebAppShortcutCreator() { } bool WebAppShortcutCreator::CreateShortcut() { - FilePath app_name = internals::GetSanitizedFileName(info_.title); - FilePath app_file_name = app_name.ReplaceExtension("app"); + base::FilePath app_name = internals::GetSanitizedFileName(info_.title); + base::FilePath app_file_name = app_name.ReplaceExtension("app"); base::ScopedTempDir scoped_temp_dir; if (!scoped_temp_dir.CreateUniqueTempDir()) return false; - FilePath staging_path = scoped_temp_dir.path().Append(app_file_name); + base::FilePath staging_path = scoped_temp_dir.path().Append(app_file_name); // Update the app's plist and icon in a temp directory. This works around // a Finder bug where the app's icon doesn't properly update. @@ -117,7 +117,7 @@ bool WebAppShortcutCreator::CreateShortcut() { if (!UpdateIcon(staging_path)) return false; - FilePath dst_path = GetDestinationPath(app_file_name); + base::FilePath dst_path = GetDestinationPath(app_file_name); if (!file_util::CopyDirectory(staging_path, dst_path, true)) { LOG(ERROR) << "Copying app to dst path: " << dst_path.value() << " failed"; return false; @@ -130,14 +130,14 @@ bool WebAppShortcutCreator::CreateShortcut() { return true; } -FilePath WebAppShortcutCreator::GetAppLoaderPath() const { +base::FilePath WebAppShortcutCreator::GetAppLoaderPath() const { return base::mac::PathForFrameworkBundleResource( base::mac::NSToCFCast(@"app_mode_loader.app")); } -FilePath WebAppShortcutCreator::GetDestinationPath( - const FilePath& app_file_name) const { - FilePath path; +base::FilePath WebAppShortcutCreator::GetDestinationPath( + const base::FilePath& app_file_name) const { + base::FilePath path; if (base::mac::GetLocalDirectory(NSApplicationDirectory, &path) && file_util::PathIsWritable(path)) { return path; @@ -146,10 +146,10 @@ FilePath WebAppShortcutCreator::GetDestinationPath( if (base::mac::GetUserDirectory(NSApplicationDirectory, &path)) return path; - return FilePath(); + return base::FilePath(); } -bool WebAppShortcutCreator::UpdatePlist(const FilePath& app_path) const { +bool WebAppShortcutCreator::UpdatePlist(const base::FilePath& app_path) const { NSString* plist_path = base::mac::FilePathToNSString( app_path.Append("Contents").Append("Info.plist")); @@ -194,7 +194,7 @@ bool WebAppShortcutCreator::UpdatePlist(const FilePath& app_path) const { return [plist writeToFile:plist_path atomically:YES]; } -bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { +bool WebAppShortcutCreator::UpdateIcon(const base::FilePath& app_path) const { if (info_.favicon.IsEmpty()) return true; @@ -220,10 +220,11 @@ bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { if (!image_added) return false; - FilePath resources_path = app_path.Append("Contents").Append("Resources"); + base::FilePath resources_path = + app_path.Append("Contents").Append("Resources"); if (!file_util::CreateDirectory(resources_path)) return false; - FilePath icon_path = resources_path.Append("app.icns"); + base::FilePath icon_path = resources_path.Append("app.icns"); return [icon_family writeToFile:base::mac::FilePathToNSString(icon_path)]; } @@ -243,7 +244,7 @@ NSString* WebAppShortcutCreator::GetBundleIdentifier(NSDictionary* plist) const } void WebAppShortcutCreator::RevealGeneratedBundleInFinder( - const FilePath& generated_bundle) const { + const base::FilePath& generated_bundle) const { [[NSWorkspace sharedWorkspace] selectFile:base::mac::FilePathToNSString(generated_bundle) inFileViewerRootedAtPath:nil]; @@ -256,7 +257,7 @@ namespace web_app { namespace internals { bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); @@ -266,14 +267,14 @@ bool CreatePlatformShortcuts( } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // TODO(benwells): Implement this when shortcuts / weblings are enabled on // mac. } void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // TODO(benwells): Implement this when shortcuts / weblings are enabled on // mac. diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm index 575eafc..ee6b647 100644 --- a/chrome/browser/web_applications/web_app_mac_unittest.mm +++ b/chrome/browser/web_applications/web_app_mac_unittest.mm @@ -34,21 +34,22 @@ class WebAppShortcutCreatorMock : public web_app::WebAppShortcutCreator { public: explicit WebAppShortcutCreatorMock( const ShellIntegration::ShortcutInfo& shortcut_info) - : WebAppShortcutCreator(FilePath("/fake/path"), shortcut_info, + : WebAppShortcutCreator(base::FilePath("/fake/path"), shortcut_info, UTF8ToUTF16("fake.cfbundleidentifier")) { } - MOCK_CONST_METHOD1(GetDestinationPath, FilePath(const FilePath&)); - MOCK_CONST_METHOD1(RevealGeneratedBundleInFinder, void(const FilePath&)); + MOCK_CONST_METHOD1(GetDestinationPath, base::FilePath(const base::FilePath&)); + MOCK_CONST_METHOD1(RevealGeneratedBundleInFinder, + void (const base::FilePath&)); }; ShellIntegration::ShortcutInfo GetShortcutInfo() { ShellIntegration::ShortcutInfo info; info.extension_id = "extension_id"; - info.extension_path = FilePath("/fake/extension/path"); + info.extension_path = base::FilePath("/fake/extension/path"); info.title = ASCIIToUTF16("Shortcut Title"); info.url = GURL("http://example.com/"); - info.profile_path = FilePath("Default"); + info.profile_path = base::FilePath("Default"); return info; } @@ -62,8 +63,8 @@ TEST(WebAppShortcutCreatorTest, CreateShortcut) { ShellIntegration::ShortcutInfo info = GetShortcutInfo(); - FilePath dst_folder = scoped_temp_dir.path(); - FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); + base::FilePath dst_folder = scoped_temp_dir.path(); + base::FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); NiceMock<WebAppShortcutCreatorMock> shortcut_creator(info); EXPECT_CALL(shortcut_creator, GetDestinationPath(_)) @@ -73,7 +74,7 @@ TEST(WebAppShortcutCreatorTest, CreateShortcut) { EXPECT_TRUE(shortcut_creator.CreateShortcut()); EXPECT_TRUE(file_util::PathExists(dst_path)); - FilePath plist_path = dst_path.Append("Contents").Append("Info.plist"); + base::FilePath plist_path = dst_path.Append("Contents").Append("Info.plist"); NSDictionary* plist = [NSDictionary dictionaryWithContentsOfFile: base::mac::FilePathToNSString(plist_path)]; EXPECT_NSEQ(base::SysUTF8ToNSString(info.extension_id), @@ -100,9 +101,9 @@ TEST(WebAppShortcutCreatorTest, RunShortcut) { ShellIntegration::ShortcutInfo info = GetShortcutInfo(); - FilePath dst_folder = scoped_temp_dir.path(); - dst_folder = FilePath("/Applications"); - FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); + base::FilePath dst_folder = scoped_temp_dir.path(); + dst_folder = base::FilePath("/Applications"); + base::FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); NiceMock<WebAppShortcutCreatorMock> shortcut_creator(info); EXPECT_CALL(shortcut_creator, GetDestinationPath(_)) @@ -121,14 +122,14 @@ TEST(WebAppShortcutCreatorTest, RunShortcut) { TEST(WebAppShortcutCreatorTest, CreateFailure) { NiceMock<WebAppShortcutCreatorMock> shortcut_creator(GetShortcutInfo()); EXPECT_CALL(shortcut_creator, GetDestinationPath(_)) - .WillRepeatedly(Return(FilePath("/non-existant/path/"))); + .WillRepeatedly(Return(base::FilePath("/non-existant/path/"))); EXPECT_FALSE(shortcut_creator.CreateShortcut()); } TEST(WebAppShortcutCreatorTest, UpdateIcon) { base::ScopedTempDir scoped_temp_dir; ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); - FilePath dst_path = scoped_temp_dir.path(); + base::FilePath dst_path = scoped_temp_dir.path(); ShellIntegration::ShortcutInfo info = GetShortcutInfo(); info.favicon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( @@ -136,7 +137,7 @@ TEST(WebAppShortcutCreatorTest, UpdateIcon) { WebAppShortcutCreatorMock shortcut_creator(info); shortcut_creator.UpdateIcon(dst_path); - FilePath icon_path = + base::FilePath icon_path = dst_path.Append("Contents").Append("Resources").Append("app.icns"); scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 7a3961d..2a8c082 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -60,18 +60,19 @@ TEST_F(WebApplicationTest, MAYBE_GetShortcutInfoForTab) { } TEST_F(WebApplicationTest, AppDirWithId) { - FilePath profile_path(FILE_PATH_LITERAL("profile")); - FilePath result(web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); - FilePath expected = profile_path.AppendASCII("Web Applications") + base::FilePath profile_path(FILE_PATH_LITERAL("profile")); + base::FilePath result( + web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); + base::FilePath expected = profile_path.AppendASCII("Web Applications") .AppendASCII("_crx_123"); EXPECT_EQ(expected, result); } TEST_F(WebApplicationTest, AppDirWithUrl) { - FilePath profile_path(FILE_PATH_LITERAL("profile")); - FilePath result(web_app::GetWebAppDataDirectory( + base::FilePath profile_path(FILE_PATH_LITERAL("profile")); + base::FilePath result(web_app::GetWebAppDataDirectory( profile_path, "", GURL("http://example.com"))); - FilePath expected = profile_path.AppendASCII("Web Applications") + base::FilePath expected = profile_path.AppendASCII("Web Applications") .AppendASCII("example.com") .AppendASCII("http_80"); EXPECT_EQ(expected, result); diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 8a6419d..0fa8a04 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -23,7 +23,8 @@ namespace { -const FilePath::CharType kIconChecksumFileExt[] = FILE_PATH_LITERAL(".ico.md5"); +const base::FilePath::CharType kIconChecksumFileExt[] = + FILE_PATH_LITERAL(".ico.md5"); // Calculates image checksum using MD5. void GetImageCheckSum(const SkBitmap& image, base::MD5Digest* digest) { @@ -34,22 +35,24 @@ void GetImageCheckSum(const SkBitmap& image, base::MD5Digest* digest) { } // Saves |image| as an |icon_file| with the checksum. -bool SaveIconWithCheckSum(const FilePath& icon_file, const SkBitmap& image) { +bool SaveIconWithCheckSum(const base::FilePath& icon_file, + const SkBitmap& image) { if (!IconUtil::CreateIconFileFromSkBitmap(image, SkBitmap(), icon_file)) return false; base::MD5Digest digest; GetImageCheckSum(image, &digest); - FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); + base::FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); return file_util::WriteFile(cheksum_file, reinterpret_cast<const char*>(&digest), sizeof(digest)) == sizeof(digest); } // Returns true if |icon_file| is missing or different from |image|. -bool ShouldUpdateIcon(const FilePath& icon_file, const SkBitmap& image) { - FilePath checksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); +bool ShouldUpdateIcon(const base::FilePath& icon_file, const SkBitmap& image) { + base::FilePath checksum_file( + icon_file.ReplaceExtension(kIconChecksumFileExt)); // Returns true if icon_file or checksum file is missing. if (!file_util::PathExists(icon_file) || @@ -70,10 +73,10 @@ bool ShouldUpdateIcon(const FilePath& icon_file, const SkBitmap& image) { sizeof(base::MD5Digest)) != 0; } -std::vector<FilePath> GetShortcutPaths( +std::vector<base::FilePath> GetShortcutPaths( ShellIntegration::ShortcutInfo shortcut_info) { // Shortcut paths under which to create shortcuts. - std::vector<FilePath> shortcut_paths; + std::vector<base::FilePath> shortcut_paths; // Locations to add to shortcut_paths. struct { @@ -103,7 +106,7 @@ std::vector<FilePath> GetShortcutPaths( // Populate shortcut_paths. for (int i = 0; i < arraysize(locations); ++i) { if (locations[i].use_this_location) { - FilePath path; + base::FilePath path; // Skip the Win7 case. if (locations[i].location_id == base::PATH_START) @@ -123,8 +126,8 @@ std::vector<FilePath> GetShortcutPaths( return shortcut_paths; } -bool ShortcutIsForProfile(const FilePath& shortcut_file_name, - const FilePath& profile_path) { +bool ShortcutIsForProfile(const base::FilePath& shortcut_file_name, + const base::FilePath& profile_path) { string16 cmd_line_string; if (base::win::ResolveShortcut(shortcut_file_name, NULL, &cmd_line_string)) { cmd_line_string = L"program " + cmd_line_string; @@ -137,18 +140,18 @@ bool ShortcutIsForProfile(const FilePath& shortcut_file_name, return false; } -std::vector<FilePath> MatchingShortcutsForProfileAndExtension( - const FilePath& shortcut_path, - const FilePath& profile_path, +std::vector<base::FilePath> MatchingShortcutsForProfileAndExtension( + const base::FilePath& shortcut_path, + const base::FilePath& profile_path, const string16& shortcut_name) { - std::vector<FilePath> shortcut_paths; - FilePath base_path = shortcut_path. + std::vector<base::FilePath> shortcut_paths; + base::FilePath base_path = shortcut_path. Append(web_app::internals::GetSanitizedFileName(shortcut_name)). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); const int fileNamesToCheck = 10; for (int i = 0; i < fileNamesToCheck; ++i) { - FilePath shortcut_file = base_path; + base::FilePath shortcut_file = base_path; if (i) { shortcut_file = shortcut_file.InsertBeforeExtensionASCII( StringPrintf(" (%d)", i)); @@ -170,7 +173,7 @@ namespace internals { // Saves |image| to |icon_file| if the file is outdated and refresh shell's // icon cache to ensure correct icon is displayed. Returns true if icon_file // is up to date or successfully updated. -bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image) { +bool CheckAndSaveIcon(const base::FilePath& icon_file, const SkBitmap& image) { if (ShouldUpdateIcon(icon_file, image)) { if (SaveIconWithCheckSum(icon_file, image)) { // Refresh shell's icon cache. This call is quite disruptive as user would @@ -186,7 +189,7 @@ bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image) { return true; } -FilePath GetShortcutExecutablePath( +base::FilePath GetShortcutExecutablePath( const ShellIntegration::ShortcutInfo& shortcut_info) { if (shortcut_info.is_platform_app && BrowserDistribution::GetDistribution()->AppHostIsSupported() && @@ -198,12 +201,12 @@ FilePath GetShortcutExecutablePath( } bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); // Shortcut paths under which to create shortcuts. - std::vector<FilePath> shortcut_paths = GetShortcutPaths(shortcut_info); + std::vector<base::FilePath> shortcut_paths = GetShortcutPaths(shortcut_info); bool pin_to_taskbar = shortcut_info.create_in_quick_launch_bar && (base::win::GetVersion() >= base::win::VERSION_WIN7); @@ -226,22 +229,22 @@ bool CreatePlatformShortcuts( } // Generates file name to use with persisted ico and shortcut file. - FilePath file_name = + base::FilePath file_name = web_app::internals::GetSanitizedFileName(shortcut_info.title); // Creates an ico file to use with shortcut. - FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( + base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( FILE_PATH_LITERAL(".ico")); if (!web_app::internals::CheckAndSaveIcon(icon_file, *shortcut_info.favicon.ToSkBitmap())) { return false; } - FilePath target_exe = GetShortcutExecutablePath(shortcut_info); + base::FilePath target_exe = GetShortcutExecutablePath(shortcut_info); DCHECK(!target_exe.empty()); // Working directory. - FilePath working_dir(target_exe.DirName()); + base::FilePath working_dir(target_exe.DirName()); CommandLine cmd_line(CommandLine::NO_PROGRAM); cmd_line = ShellIntegration::CommandLineArgsForLauncher(shortcut_info.url, @@ -263,10 +266,10 @@ bool CreatePlatformShortcuts( string16 app_id(ShellIntegration::GetAppModelIdForProfile( UTF8ToUTF16(app_name), shortcut_info.profile_path)); - FilePath shortcut_to_pin; + base::FilePath shortcut_to_pin; bool success = true; for (size_t i = 0; i < shortcut_paths.size(); ++i) { - FilePath shortcut_file = shortcut_paths[i].Append(file_name). + base::FilePath shortcut_file = shortcut_paths[i].Append(file_name). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); int unique_number = @@ -309,15 +312,15 @@ bool CreatePlatformShortcuts( } void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // Generates file name to use with persisted ico and shortcut file. - FilePath file_name = + base::FilePath file_name = web_app::internals::GetSanitizedFileName(shortcut_info.title); // If an icon file exists, and is out of date, replace it with the new icon // and let the shell know the icon has been modified. - FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( + base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( FILE_PATH_LITERAL(".ico")); if (file_util::PathExists(icon_file)) { web_app::internals::CheckAndSaveIcon(icon_file, @@ -326,7 +329,7 @@ void UpdatePlatformShortcuts( } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); @@ -335,17 +338,18 @@ void DeletePlatformShortcuts( all_shortcuts_info.create_in_applications_menu = true; all_shortcuts_info.create_in_quick_launch_bar = true; all_shortcuts_info.create_on_desktop = true; - std::vector<FilePath> shortcut_locations = GetShortcutPaths( + std::vector<base::FilePath> shortcut_locations = GetShortcutPaths( all_shortcuts_info); if (base::win::GetVersion() >= base::win::VERSION_WIN7) shortcut_locations.push_back(web_app_path); - for (std::vector<FilePath>::const_iterator i = shortcut_locations.begin(); + for (std::vector<base::FilePath>::const_iterator i = + shortcut_locations.begin(); i != shortcut_locations.end(); ++i) { - std::vector<FilePath> shortcut_files = + std::vector<base::FilePath> shortcut_files = MatchingShortcutsForProfileAndExtension(*i, shortcut_info.profile_path, shortcut_info.title); - for (std::vector<FilePath>::const_iterator j = shortcut_files.begin(); + for (std::vector<base::FilePath>::const_iterator j = shortcut_files.begin(); j != shortcut_files.end(); ++j) { // Any shortcut could have been pinned, either by chrome or the user, so // they are all unpinned. |