summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 18:04:33 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 18:04:33 +0000
commit8ce9e490f79236a93767ab3e153995e9c19735dd (patch)
tree08aaf3e0b68f7a3e9b84691999f719cf5fc992bb
parent814e87b6e5236aaa38d97a9e2b2e9e6a4bae2c59 (diff)
downloadchromium_src-8ce9e490f79236a93767ab3e153995e9c19735dd.zip
chromium_src-8ce9e490f79236a93767ab3e153995e9c19735dd.tar.gz
chromium_src-8ce9e490f79236a93767ab3e153995e9c19735dd.tar.bz2
FilePath: remove some functions that aren't really used.
And fix the one caller. Review URL: http://codereview.chromium.org/7087009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87327 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/file_path.cc35
-rw-r--r--base/file_path.h6
-rw-r--r--chrome/browser/bookmarks/bookmark_node_data.cc28
-rw-r--r--chrome/browser/bookmarks/bookmark_node_data.h4
4 files changed, 29 insertions, 44 deletions
diff --git a/base/file_path.cc b/base/file_path.cc
index 0d0b40b..35361be 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -551,43 +551,26 @@ FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
}
#endif
-// static.
-void FilePath::WriteStringTypeToPickle(Pickle* pickle,
- const StringType& path) {
-#if defined(WCHAR_T_IS_UTF16)
- pickle->WriteWString(path);
-#elif defined(WCHAR_T_IS_UTF32)
- pickle->WriteString(path);
+void FilePath::WriteToPickle(Pickle* pickle) {
+#if defined(OS_WIN)
+ pickle->WriteString16(path_);
#else
- NOTIMPLEMENTED() << "Impossible encoding situation!";
+ pickle->WriteString(path_);
#endif
}
-// static.
-bool FilePath::ReadStringTypeFromPickle(Pickle* pickle, void** iter,
- StringType* path) {
-#if defined(WCHAR_T_IS_UTF16)
- if (!pickle->ReadWString(iter, path))
- return false;
-#elif defined(WCHAR_T_IS_UTF32)
- if (!pickle->ReadString(iter, path))
+bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) {
+#if defined(OS_WIN)
+ if (!pickle->ReadString16(iter, &path_))
return false;
#else
- NOTIMPLEMENTED() << "Impossible encoding situation!";
- return false;
+ if (!pickle->ReadString(iter, &path_))
+ return false;
#endif
return true;
}
-void FilePath::WriteToPickle(Pickle* pickle) {
- WriteStringTypeToPickle(pickle, value());
-}
-
-bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) {
- return ReadStringTypeFromPickle(pickle, iter, &path_);
-}
-
#if defined(OS_WIN)
// Windows specific implementation of file string comparisons
diff --git a/base/file_path.h b/base/file_path.h
index bdcb03a..f60a80c 100644
--- a/base/file_path.h
+++ b/base/file_path.h
@@ -312,12 +312,6 @@ class BASE_API FilePath {
// ever use the result of that again as a path.
static FilePath FromWStringHack(const std::wstring& wstring);
- // Static helper method to write a StringType to a pickle.
- static void WriteStringTypeToPickle(Pickle* pickle,
- const FilePath::StringType& path);
- static bool ReadStringTypeFromPickle(Pickle* pickle, void** iter,
- FilePath::StringType* path);
-
void WriteToPickle(Pickle* pickle);
bool ReadFromPickle(Pickle* pickle, void** iter);
diff --git a/chrome/browser/bookmarks/bookmark_node_data.cc b/chrome/browser/bookmarks/bookmark_node_data.cc
index ed2d38c..b24432a 100644
--- a/chrome/browser/bookmarks/bookmark_node_data.cc
+++ b/chrome/browser/bookmarks/bookmark_node_data.cc
@@ -198,17 +198,26 @@ bool BookmarkNodeData::ClipboardContainsBookmarks() {
}
#else
void BookmarkNodeData::WriteToClipboard(Profile* profile) const {
- bookmark_pasteboard_helper_mac::WriteToClipboard(elements, profile_path_);
+ bookmark_pasteboard_helper_mac::WriteToClipboard(elements,
+ profile_path_.value());
}
bool BookmarkNodeData::ReadFromClipboard() {
- return bookmark_pasteboard_helper_mac::ReadFromClipboard(elements,
- &profile_path_);
+ // TODO(evan): bookmark_pasteboard_helper_mac should just use FilePaths.
+ FilePath::StringType buf;
+ if (!bookmark_pasteboard_helper_mac::ReadFromClipboard(elements, &buf))
+ return false;
+ profile_path_ = FilePath(buf);
+ return true;
}
bool BookmarkNodeData::ReadFromDragClipboard() {
- return bookmark_pasteboard_helper_mac::ReadFromDragClipboard(elements,
- &profile_path_);
+ // TODO(evan): bookmark_pasteboard_helper_mac should just use FilePaths.
+ FilePath::StringType buf;
+ if (!bookmark_pasteboard_helper_mac::ReadFromDragClipboard(elements, &buf))
+ return false;
+ profile_path_ = FilePath(buf);
+ return true;
}
bool BookmarkNodeData::ClipboardContainsBookmarks() {
@@ -262,7 +271,7 @@ bool BookmarkNodeData::Read(const ui::OSExchangeData& data) {
void BookmarkNodeData::WriteToPickle(Profile* profile, Pickle* pickle) const {
FilePath path = profile ? profile->GetPath() : FilePath();
- FilePath::WriteStringTypeToPickle(pickle, path.value());
+ path.WriteToPickle(pickle);
pickle->WriteSize(elements.size());
for (size_t i = 0; i < elements.size(); ++i)
@@ -272,8 +281,7 @@ void BookmarkNodeData::WriteToPickle(Profile* profile, Pickle* pickle) const {
bool BookmarkNodeData::ReadFromPickle(Pickle* pickle) {
void* data_iterator = NULL;
size_t element_count;
- if (FilePath::ReadStringTypeFromPickle(pickle, &data_iterator,
- &profile_path_) &&
+ if (profile_path_.ReadFromPickle(pickle, &data_iterator) &&
pickle->ReadSize(&data_iterator, &element_count)) {
std::vector<Element> tmp_elements;
tmp_elements.resize(element_count);
@@ -321,10 +329,10 @@ void BookmarkNodeData::SetOriginatingProfile(Profile* profile) {
DCHECK(profile_path_.empty());
if (profile)
- profile_path_ = profile->GetPath().value();
+ profile_path_ = profile->GetPath();
}
bool BookmarkNodeData::IsFromProfile(Profile* profile) const {
// An empty path means the data is not associated with any profile.
- return !profile_path_.empty() && profile_path_ == profile->GetPath().value();
+ return !profile_path_.empty() && profile_path_ == profile->GetPath();
}
diff --git a/chrome/browser/bookmarks/bookmark_node_data.h b/chrome/browser/bookmarks/bookmark_node_data.h
index adde83c..9519bb4 100644
--- a/chrome/browser/bookmarks/bookmark_node_data.h
+++ b/chrome/browser/bookmarks/bookmark_node_data.h
@@ -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.
@@ -160,7 +160,7 @@ struct BookmarkNodeData {
private:
// Path of the profile we originated from.
- FilePath::StringType profile_path_;
+ FilePath profile_path_;
};
#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_