Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: chrome/common/chrome_paths_linux.cc

Issue 6528028: Cleanup: Make chrome paths code more consistent and use more constants when p... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/common/chrome_paths.cc ('K') | « chrome/common/chrome_paths.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_paths_linux.cc
===================================================================
--- chrome/common/chrome_paths_linux.cc (revision 74997)
+++ chrome/common/chrome_paths_linux.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -10,6 +10,14 @@
#include "base/scoped_ptr.h"
#include "base/nix/xdg_util.h"
+namespace {
+
+const char kDotConfig[] = ".config";
viettrungluu 2011/02/16 16:34:25 These already have internal linkage, so the anonym
Lei Zhang 2011/02/17 03:19:46 Done.
+const char kDownloads[] = "Downloads";
+const char kXdgConfigHome[] = "XDG_CONFIG_HOME";
+
+} // namespace
+
namespace chrome {
// See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
@@ -20,7 +28,7 @@
bool GetDefaultUserDataDirectory(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
FilePath config_dir(
- base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config"));
+ base::nix::GetXDGDirectory(env.get(), kXdgConfigHome, kDotConfig));
#if defined(GOOGLE_CHROME_BUILD)
*result = config_dir.Append("google-chrome");
#else
@@ -47,7 +55,7 @@
if (!PathService::Get(base::DIR_CACHE, &cache_dir))
return;
FilePath config_dir(
- base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config"));
+ base::nix::GetXDGDirectory(env.get(), kXdgConfigHome, kDotConfig));
if (!config_dir.AppendRelativePath(profile_dir, &cache_dir))
return;
@@ -58,7 +66,7 @@
bool GetChromeFrameUserDataDirectory(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
FilePath config_dir(
- base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config"));
+ base::nix::GetXDGDirectory(env.get(), kXdgConfigHome, kDotConfig));
#if defined(GOOGLE_CHROME_BUILD)
*result = config_dir.Append("google-chrome-frame");
#else
@@ -77,18 +85,18 @@
// ~ or their desktop directory, in which case we default to ~/Downloads.
bool GetUserDownloadsDirectory(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
- *result = base::nix::GetXDGUserDirectory(env.get(), "DOWNLOAD", "Downloads");
+ *result = base::nix::GetXDGUserDirectory(env.get(), "DOWNLOAD", kDownloads);
FilePath home = file_util::GetHomeDir();
if (*result == home) {
- *result = home.Append("Downloads");
+ *result = home.Append(kDownloads);
return true;
}
FilePath desktop;
GetUserDesktop(&desktop);
if (*result == desktop) {
- *result = home.Append("Downloads");
+ *result = home.Append(kDownloads);
}
return true;
« chrome/common/chrome_paths.cc ('K') | « chrome/common/chrome_paths.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698