diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/download/download_manager.cc | 11 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/common/chrome_paths_mac.cc | 38 | ||||
-rw-r--r-- | chrome/common/chrome_paths_mac.mm | 61 |
4 files changed, 62 insertions, 50 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index aafb641..f46cac5 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -92,8 +92,6 @@ static int GetUniquePathNumber(const FilePath& path) { return -1; } -// TODO(port): enable this for mac later. For now, it gives a not used warning. -#if defined(OS_WIN) || defined(OS_LINUX) static bool DownloadPathIsDangerous(const FilePath& download_path) { FilePath desktop_dir; if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { @@ -102,7 +100,6 @@ static bool DownloadPathIsDangerous(const FilePath& download_path) { } return (download_path == desktop_dir); } -#endif // DownloadItem implementation ------------------------------------------------- @@ -299,8 +296,6 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen, L""); prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false); -// TODO(port): port the necessary bits of chrome_paths_mac. -#if defined(OS_WIN) || defined(OS_LINUX) // The default download path is userprofile\download. FilePath default_download_path; if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, @@ -323,7 +318,6 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) { } prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); } -#endif // defined(OS_WIN) || defined(OS_LINUX) } DownloadManager::DownloadManager() @@ -486,8 +480,6 @@ bool DownloadManager::Init(Profile* profile) { DCHECK(prefs); prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); -// TODO(port): enable this after implementing chrome_paths for mac. -#if defined(OS_WIN) || defined(OS_LINUX) download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); // This variable is needed to resolve which CreateDirectory we want to point @@ -498,9 +490,6 @@ bool DownloadManager::Init(Profile* profile) { // Ensure that the download directory specified in the preferences exists. file_loop_->PostTask(FROM_HERE, NewRunnableFunction( CreateDirectoryPtr, download_path())); -#elif defined(OS_MACOSX) - NOTIMPLEMENTED(); -#endif #if defined(OS_WIN) // We use this on windows to determine possibly dangerous downloads. diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 2733678..f329004 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -143,7 +143,7 @@ 'common/chrome_paths.h', 'common/chrome_paths_internal.h', 'common/chrome_paths_linux.cc', - 'common/chrome_paths_mac.cc', + 'common/chrome_paths_mac.mm', 'common/chrome_paths_win.cc', 'common/chrome_plugin_api.h', 'common/chrome_plugin_lib.cc', diff --git a/chrome/common/chrome_paths_mac.cc b/chrome/common/chrome_paths_mac.cc deleted file mode 100644 index ebc9876..0000000 --- a/chrome/common/chrome_paths_mac.cc +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/chrome_paths_internal.h" - -#include "base/base_paths.h" -#include "base/file_path.h" -#include "base/logging.h" -#include "base/path_service.h" - -namespace chrome { - -bool GetDefaultUserDataDirectory(FilePath* result) { - if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) - return false; - return true; -} - -bool GetUserDocumentsDirectory(FilePath* result) { - // TODO(port) - NOTIMPLEMENTED(); - return false; -} - -bool GetUserDownloadsDirectory(FilePath* result) { - // TODO(port) - NOTIMPLEMENTED(); - return false; -} - -bool GetUserDesktop(FilePath* result) { - // TODO(port) - NOTIMPLEMENTED(); - return false; -} - -} // namespace chrome diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm new file mode 100644 index 0000000..1e00bf9 --- /dev/null +++ b/chrome/common/chrome_paths_mac.mm @@ -0,0 +1,61 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "chrome/common/chrome_paths_internal.h" + +#import <Cocoa/Cocoa.h> + +#import "base/base_paths.h" +#import "base/file_path.h" +#import "base/logging.h" +#import "base/path_service.h" + +namespace chrome { + +bool GetDefaultUserDataDirectory(FilePath* result) { + if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) + return false; + return true; +} + +bool GetUserDocumentsDirectory(FilePath* result) { + bool success = false; + NSArray* docArray = + NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, + NSUserDomainMask, + YES); + if ([docArray count] && result) { + *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]); + success = true; + } + return success; +} + +bool GetUserDownloadsDirectory(FilePath* result) { + bool success = false; + NSArray* docArray = + NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, + NSUserDomainMask, + YES); + if ([docArray count] && result) { + *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]); + success = true; + } + return success; +} + +bool GetUserDesktop(FilePath* result) { + bool success = false; + NSArray* docArray = + NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, + NSUserDomainMask, + YES); + if ([docArray count] && result) { + *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]); + success = true; + } + return success; +} + +} // namespace chrome |