summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj6
-rw-r--r--chrome/common/chrome_paths.cc70
-rw-r--r--chrome/common/chrome_paths_internal.h26
-rw-r--r--chrome/common/chrome_paths_linux.cc31
-rw-r--r--chrome/common/chrome_paths_mac.cc32
-rw-r--r--chrome/common/chrome_paths_win.cc52
-rw-r--r--chrome/common/common.scons12
-rw-r--r--chrome/common/common.vcproj8
8 files changed, 172 insertions, 65 deletions
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index baa8874..46287d6 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -87,6 +87,7 @@
3380A9D70F2FC8F9004EF74F /* render_dns_master.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640CE10EAE86A500EBCFC0 /* render_dns_master.cc */; };
3AEA44DB19C9D93B63D7A2E4 /* url_fetcher_protect.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0B7CC9C105E90E0665852528 /* url_fetcher_protect.cc */; };
406DFE278638D6132B21B2C9 /* url_pattern.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6447F24FADC63E58A44DB762 /* url_pattern.cc */; };
+ 4D175916B2FC058793051209 /* chrome_paths_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */; };
4D1F59FE0F2A6BBB0040C1E3 /* image_diff.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D1F59FD0F2A6BBB0040C1E3 /* image_diff.cc */; };
4D1F5A060F2A6D170040C1E3 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC70E9D525B009A6919 /* libbase.a */; };
4D1F5AAE0F2A6ECB0040C1E3 /* libbase_gfx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC90E9D525B009A6919 /* libbase_gfx.a */; };
@@ -1848,6 +1849,7 @@
534E66C30F311BEC0006B2B2 /* temp_scaffolding_stubs.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = temp_scaffolding_stubs.cc; sourceTree = "<group>"; };
6447F24FADC63E58A44DB762 /* url_pattern.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = url_pattern.cc; path = common/extensions/url_pattern.cc; sourceTree = SOURCE_ROOT; };
778D7927798B7E3FAA498D3D /* url_fetcher.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = url_fetcher.cc; sourceTree = "<group>"; };
+ 8104B4AFD95DCA06B2F37551 /* chrome_paths_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chrome_paths_internal.h; sourceTree = "<group>"; };
82684C5F0F2FAE68009F6555 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
82684CCF0F2FAEC2009F6555 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
82684D050F2FB101009F6555 /* sdch.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sdch.xcodeproj; path = sdch/sdch.xcodeproj; sourceTree = "<group>"; };
@@ -1990,6 +1992,7 @@
B6CCB9F70F1EC32700106F0D /* web_drag_source.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = web_drag_source.h; path = tab_contents/web_drag_source.h; sourceTree = "<group>"; };
B6CCB9F80F1EC32700106F0D /* web_drop_target.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = web_drop_target.cc; path = tab_contents/web_drop_target.cc; sourceTree = "<group>"; };
B6CCB9F90F1EC32700106F0D /* web_drop_target.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = web_drop_target.h; path = tab_contents/web_drop_target.h; sourceTree = "<group>"; };
+ C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chrome_paths_mac.cc; sourceTree = "<group>"; };
B94B5B0CBF4D7FAC48BB1AE2 /* backing_store_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = backing_store_posix.cc; path = browser/renderer_host/backing_store_posix.cc; sourceTree = SOURCE_ROOT; };
E40CC5E10F2E348900708647 /* history_contents_provider.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = history_contents_provider.cc; path = autocomplete/history_contents_provider.cc; sourceTree = "<group>"; };
E40CC5E20F2E348900708647 /* history_contents_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = history_contents_provider.h; path = autocomplete/history_contents_provider.h; sourceTree = "<group>"; };
@@ -2947,6 +2950,8 @@
4D7BFB8E0E9D4C9F009A6919 /* chrome_counters.h */,
4D7BFB8F0E9D4C9F009A6919 /* chrome_paths.cc */,
4D7BFB900E9D4C9F009A6919 /* chrome_paths.h */,
+ 8104B4AFD95DCA06B2F37551 /* chrome_paths_internal.h */,
+ C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */,
4D7BFB910E9D4C9F009A6919 /* chrome_plugin_api.h */,
4D7BFB920E9D4C9F009A6919 /* chrome_plugin_lib.cc */,
4D7BFB930E9D4C9F009A6919 /* chrome_plugin_lib.h */,
@@ -4672,6 +4677,7 @@
4D7BFC280E9D4CEB009A6919 /* chrome_constants.cc in Sources */,
4D7BFC2A0E9D4CED009A6919 /* chrome_counters.cc in Sources */,
E4F3256E0EE82C83002533CE /* chrome_paths.cc in Sources */,
+ 4D175916B2FC058793051209 /* chrome_paths_mac.cc in Sources */,
4D7BFC2C0E9D4CF1009A6919 /* chrome_switches.cc in Sources */,
4D7BFCC90E9D4D72009A6919 /* color_utils.cc in Sources */,
B562E2C70F0582F800FB1A4F /* common_glue.cc in Sources */,
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 2ca8dc1..c3c542d 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -2,14 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "build/build_config.h"
-
-#if defined(OS_WIN)
-#include <windows.h>
-#include <shellapi.h>
-#include <shlobj.h>
-#endif
-
#include "chrome/common/chrome_paths.h"
#include "base/command_line.h"
@@ -20,33 +12,11 @@
#include "base/string_util.h"
#include "base/sys_info.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
namespace chrome {
-// Gets the default user data directory, regardless of whether
-// DIR_USER_DATA has been overridden by a command-line option.
-bool GetDefaultUserDataDirectory(FilePath* result) {
-#if defined(OS_WIN)
- if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
- return false;
-#if defined(GOOGLE_CHROME_BUILD)
- *result = result->Append(FILE_PATH_LITERAL("Google"));
-#endif
- *result = result->Append(chrome::kBrowserAppName);
- *result = result->Append(chrome::kUserDataDirname);
- return true;
-#elif defined(OS_MACOSX)
- if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
- return false;
- return true;
-#elif defined(OS_LINUX)
- // TODO(port): Decide what to do on linux.
- NOTIMPLEMENTED();
- return false;
-#endif // defined(OS_WIN)
-}
-
bool GetGearsPluginPathFromCommandLine(FilePath* path) {
#ifndef NDEBUG
// for debugging, support a cmd line based override
@@ -88,20 +58,8 @@ bool PathProvider(int key, FilePath* result) {
create_dir = true;
break;
case chrome::DIR_USER_DOCUMENTS:
-#if defined(OS_WIN)
- {
- wchar_t path_buf[MAX_PATH];
- if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL,
- SHGFP_TYPE_CURRENT, path_buf)))
- return false;
- cur = FilePath(path_buf);
- }
-#else
- // TODO(port): Get the path (possibly using xdg-user-dirs)
- // or decide we don't need it on other platforms.
- NOTIMPLEMENTED();
- return false;
-#endif
+ if (!GetUserDocumentsDirectory(&cur))
+ return false;
create_dir = true;
break;
case chrome::DIR_DEFAULT_DOWNLOADS:
@@ -129,26 +87,8 @@ bool PathProvider(int key, FilePath* result) {
create_dir = true;
break;
case chrome::DIR_USER_DESKTOP:
-#if defined(OS_WIN)
- {
- // We need to go compute the value. It would be nice to support paths
- // with names longer than MAX_PATH, but the system functions don't seem
- // to be designed for it either, with the exception of GetTempPath
- // (but other things will surely break if the temp path is too long,
- // so we don't bother handling it.
- wchar_t system_buffer[MAX_PATH];
- system_buffer[0] = 0;
- if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
- SHGFP_TYPE_CURRENT, system_buffer)))
- return false;
- cur = FilePath(system_buffer);
- }
-#else
- // TODO(port): Get the path (possibly using xdg-user-dirs)
- // or decide we don't need it on other platforms.
- NOTIMPLEMENTED();
- return false;
-#endif
+ if (!GetUserDesktop(&cur))
+ return false;
break;
case chrome::DIR_RESOURCES:
if (!PathService::Get(chrome::DIR_APP, &cur))
diff --git a/chrome/common/chrome_paths_internal.h b/chrome/common/chrome_paths_internal.h
new file mode 100644
index 0000000..a9912dd
--- /dev/null
+++ b/chrome/common/chrome_paths_internal.h
@@ -0,0 +1,26 @@
+// 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.
+
+#ifndef CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
+#define CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
+
+class FilePath;
+
+namespace chrome {
+
+// Get the path to the user's data directory, regardless of whether
+// DIR_USER_DATA has been overridden by a command-line option.
+bool GetDefaultUserDataDirectory(FilePath* result);
+
+// Get the path to the user's documents directory. We use this to construct
+// the default download directory.
+bool GetUserDocumentsDirectory(FilePath* result);
+
+// The path to the user's desktop.
+bool GetUserDesktop(FilePath* result);
+
+} // namespace chrome
+
+
+#endif // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc
new file mode 100644
index 0000000..c2654bb
--- /dev/null
+++ b/chrome/common/chrome_paths_linux.cc
@@ -0,0 +1,31 @@
+// 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/logging.h"
+
+namespace chrome {
+
+bool GetDefaultUserDataDirectory(FilePath* result) {
+ // TODO(port): Decide what to do on linux.
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool GetUserDocumentsDirectory(FilePath* result) {
+ // TODO(port): Get the path (possibly using xdg-user-dirs)
+ // or decide we don't need it on other platforms.
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool GetUserDesktop(FilePath* result) {
+ // TODO(port): Get the path (possibly using xdg-user-dirs)
+ // or decide we don't need it on other platforms.
+ NOTIMPLEMENTED();
+ return false;
+}
+
+} // namespace chrome
diff --git a/chrome/common/chrome_paths_mac.cc b/chrome/common/chrome_paths_mac.cc
new file mode 100644
index 0000000..788ffc1
--- /dev/null
+++ b/chrome/common/chrome_paths_mac.cc
@@ -0,0 +1,32 @@
+// 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 GetUserDesktop(FilePath* result) {
+ // TODO(port)
+ NOTIMPLEMENTED();
+ return false;
+}
+
+} // namespace chrome
diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc
new file mode 100644
index 0000000..aab3182
--- /dev/null
+++ b/chrome/common/chrome_paths_win.cc
@@ -0,0 +1,52 @@
+// 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 <windows.h>
+#include <shellapi.h>
+#include <shlobj.h>
+
+#include "base/file_path.h"
+#include "base/path_service.h"
+#include "chrome/common/chrome_constants.h"
+
+namespace chrome {
+
+bool GetDefaultUserDataDirectory(FilePath* result) {
+ if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
+ return false;
+#if defined(GOOGLE_CHROME_BUILD)
+ *result = result->Append(FILE_PATH_LITERAL("Google"));
+#endif
+ *result = result->Append(chrome::kBrowserAppName);
+ *result = result->Append(chrome::kUserDataDirname);
+ return true;
+}
+
+bool GetUserDocumentsDirectory(FilePath* result) {
+ wchar_t path_buf[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL,
+ SHGFP_TYPE_CURRENT, path_buf)))
+ return false;
+ *result = FilePath(path_buf);
+ return true;
+}
+
+bool GetUserDesktop(FilePath* result) {
+ // We need to go compute the value. It would be nice to support paths
+ // with names longer than MAX_PATH, but the system functions don't seem
+ // to be designed for it either, with the exception of GetTempPath
+ // (but other things will surely break if the temp path is too long,
+ // so we don't bother handling it.
+ wchar_t system_buffer[MAX_PATH];
+ system_buffer[0] = 0;
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
+ SHGFP_TYPE_CURRENT, system_buffer)))
+ return false;
+ *result = FilePath(system_buffer);
+ return true;
+}
+
+} // namespace chrome
diff --git a/chrome/common/common.scons b/chrome/common/common.scons
index 90b8a26..ae4c0bf 100644
--- a/chrome/common/common.scons
+++ b/chrome/common/common.scons
@@ -111,6 +111,10 @@ input_files = ChromeFileList([
'chrome_counters.h',
'chrome_paths.cc',
'chrome_paths.h',
+ 'chrome_paths_internal.h',
+ 'chrome_paths_linux.cc',
+ 'chrome_paths_mac.cc',
+ 'chrome_paths_win.cc',
'chrome_plugin_api.h',
'chrome_plugin_lib.cc',
'chrome_plugin_lib.h',
@@ -232,6 +236,7 @@ if not env.Bit('windows'):
if not env.Bit('windows'):
# Windows specific files
input_files.Remove(
+ 'chrome_paths_win.cc',
'classfactory.cc',
'gfx/chrome_canvas_win.cc',
'gfx/chrome_font_win.cc',
@@ -245,11 +250,18 @@ if not env.Bit('windows'):
if not env.Bit('linux'):
# Linux specific files
input_files.Remove(
+ 'chrome_paths_linux.cc',
'gfx/chrome_canvas_skia.cc',
'gfx/chrome_font_gtk.cc',
'gfx/chrome_font_skia.cc',
)
+if not env.Bit('mac'):
+ # Mac specific files
+ input_files.Remove(
+ 'chrome_paths_mac.cc',
+ )
+
if not env.Bit('posix'):
input_files.Remove(
'ipc_channel_posix.cc',
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index bdc1e23..c0f6af6 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -362,6 +362,14 @@
>
</File>
<File
+ RelativePath=".\chrome_paths_internal.h"
+ >
+ </File>
+ <File
+ RelativePath=".\chrome_paths_win.cc"
+ >
+ </File>
+ <File
RelativePath=".\chrome_plugin_api.h"
>
</File>