Chromium Code Reviews| 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; |