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 /chrome/installer | |
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
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/util/create_reg_key_work_item.cc | 20 |
1 files changed, 18 insertions, 2 deletions
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; |