diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-09 15:39:48 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-09 15:39:48 +0000 |
commit | b9ff9c1b2ef0abd27a642469d4bf705be58ae7f2 (patch) | |
tree | a1d97b2e680a86fac8537162b2e61b9474d8ad00 | |
parent | 51c418ffb35b1fa51368e69f3ecad1c4039f41ab (diff) | |
download | chromium_src-b9ff9c1b2ef0abd27a642469d4bf705be58ae7f2.zip chromium_src-b9ff9c1b2ef0abd27a642469d4bf705be58ae7f2.tar.gz chromium_src-b9ff9c1b2ef0abd27a642469d4bf705be58ae7f2.tar.bz2 |
file_util: Move deprecated function UpOneDirectoryOrEmpty into an anonymous namespace.
This function is used in one place and is deprecated, so would be good to move
it there so no one can make other uses of it.
BUG=24672
TEST=trybots
Review URL: http://codereview.chromium.org/2809049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51963 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/file_util.cc | 10 | ||||
-rw-r--r-- | base/file_util_deprecated.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/create_reg_key_work_item.cc | 20 |
3 files changed, 18 insertions, 14 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index bae6535..b611716 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -402,16 +402,6 @@ void UpOneDirectory(std::wstring* dir) { if (directory.value() != FilePath::kCurrentDirectory) *dir = directory.ToWStringHack(); } -void UpOneDirectoryOrEmpty(std::wstring* dir) { - FilePath path = FilePath::FromWStringHack(*dir); - FilePath directory = path.DirName(); - // If there is no separator, we will get back kCurrentDirectory. - // In this case, clear dir. - if (directory == path || directory.value() == FilePath::kCurrentDirectory) - dir->clear(); - else - *dir = directory.ToWStringHack(); -} int WriteFile(const std::wstring& filename, const char* data, int size) { return WriteFile(FilePath::FromWStringHack(filename), data, size); } diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h index dd2ffc8..1554486 100644 --- a/base/file_util_deprecated.h +++ b/base/file_util_deprecated.h @@ -28,8 +28,6 @@ FILE* OpenFile(const std::wstring& filename, const char* mode); // Use FilePath::DirName instead. void UpOneDirectory(std::wstring* dir); -// Use FilePath::DirName instead. -void UpOneDirectoryOrEmpty(std::wstring* dir); // Use FilePath::BaseName instead. std::wstring GetFilenameFromPath(const std::wstring& path); diff --git a/chrome/installer/util/create_reg_key_work_item.cc b/chrome/installer/util/create_reg_key_work_item.cc index 221fe7b..03f3367 100644 --- a/chrome/installer/util/create_reg_key_work_item.cc +++ b/chrome/installer/util/create_reg_key_work_item.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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,22 @@ #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/logging_installer.h" +namespace { + +// TODO: refactor this because it is only used once. +void UpOneDirectoryOrEmpty(std::wstring* dir) { + FilePath path = FilePath::FromWStringHack(*dir); + FilePath directory = path.DirName(); + // If there is no separator, we will get back kCurrentDirectory. + // In this case, clear dir. + if (directory == path || directory.value() == FilePath::kCurrentDirectory) + dir->clear(); + else + *dir = directory.ToWStringHack(); +} + +} // namespace + CreateRegKeyWorkItem::~CreateRegKeyWorkItem() { } @@ -98,7 +114,7 @@ bool CreateRegKeyWorkItem::InitKeyList() { key_list_.push_back(key_path); // This is pure string operation so it does not matter whether the // path is file path or registry path. - file_util::UpOneDirectoryOrEmpty(&key_path); + UpOneDirectoryOrEmpty(&key_path); } while (!key_path.empty()); return true; |