summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 06:34:13 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 06:34:13 +0000
commit6524385ef3fb2f1f26675d66cee2dad649883be6 (patch)
treec0f807e54894299399da67834a1980534daa1a2d /chrome/browser/bookmarks
parentf51ef0d27f701feb2c47096c9a73039e0c389a60 (diff)
downloadchromium_src-6524385ef3fb2f1f26675d66cee2dad649883be6.zip
chromium_src-6524385ef3fb2f1f26675d66cee2dad649883be6.tar.gz
chromium_src-6524385ef3fb2f1f26675d66cee2dad649883be6.tar.bz2
Remove wstrings from bookmarks, part 1 (of many).
Start by removing wstring versions of BookmarkModel::AddURLWithCreationTime() and BookmarkModel::SetURLStarred(). BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3111012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer_unittest.cc16
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc20
-rw-r--r--chrome/browser/bookmarks/bookmark_model.h14
-rw-r--r--chrome/browser/bookmarks/bookmark_model_unittest.cc3
4 files changed, 12 insertions, 41 deletions
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
index 042f3aa..8172437 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
@@ -8,8 +8,10 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "base/string16.h"
#include "base/string_util.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "base/i18n/time_formatting.h"
#include "chrome/browser/bookmarks/bookmark_html_writer.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -80,7 +82,7 @@ class BookmarkHTMLWriterTest : public testing::Test {
// Creates a set of bookmark values to a string for assertion testing.
std::wstring BookmarkValuesToString(bool on_toolbar,
const GURL& url,
- const std::wstring& title,
+ const string16& title,
base::Time creation_time,
const std::wstring& f1,
const std::wstring& f2,
@@ -99,7 +101,7 @@ class BookmarkHTMLWriterTest : public testing::Test {
entry.path.push_back(f3);
}
}
- entry.title = title;
+ entry.title = UTF16ToWideHack(title);
entry.creation_time = creation_time;
return BookmarkEntryToString(entry);
}
@@ -107,7 +109,7 @@ class BookmarkHTMLWriterTest : public testing::Test {
void AssertBookmarkEntryEquals(const ProfileWriter::BookmarkEntry& entry,
bool on_toolbar,
const GURL& url,
- const std::wstring& title,
+ const string16& title,
base::Time creation_time,
const std::wstring& f1,
const std::wstring& f2,
@@ -175,10 +177,10 @@ TEST_F(BookmarkHTMLWriterTest, Test) {
std::wstring f2_title = L"F2";
std::wstring f3_title = L"F 3";
std::wstring f4_title = L"F4";
- std::wstring url1_title = L"url 1";
- std::wstring url2_title = L"url&2";
- std::wstring url3_title = L"url\"3";
- std::wstring url4_title = L"url\"&;";
+ string16 url1_title = ASCIIToUTF16("url 1");
+ string16 url2_title = ASCIIToUTF16("url&2");
+ string16 url3_title = ASCIIToUTF16("url\"3");
+ string16 url4_title = ASCIIToUTF16("url\"&;");
GURL url1("http://url1");
GURL url1_favicon("http://url1/icon.ico");
GURL url2("http://url2");
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index a5c87bf..4e35c21 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.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.
@@ -398,17 +398,6 @@ const BookmarkNode* BookmarkModel::AddURL(const BookmarkNode* parent,
return AddURLWithCreationTime(parent, index, title, url, Time::Now());
}
-#if !defined(WCHAR_T_IS_UTF16)
-const BookmarkNode* BookmarkModel::AddURLWithCreationTime(
- const BookmarkNode* parent,
- int index,
- const std::wstring& title,
- const GURL& url,
- const Time& creation_time) {
- return AddURLWithCreationTime(parent, index, WideToUTF16(title),
- url, creation_time);
-}
-#endif
const BookmarkNode* BookmarkModel::AddURLWithCreationTime(
const BookmarkNode* parent,
int index,
@@ -464,13 +453,6 @@ void BookmarkModel::SortChildren(const BookmarkNode* parent) {
BookmarkNodeChildrenReordered(this, parent));
}
-#if !defined(WCHAR_T_IS_UTF16)
-void BookmarkModel::SetURLStarred(const GURL& url,
- const std::wstring& title,
- bool is_starred) {
- SetURLStarred(url, WideToUTF16(title), is_starred);
-}
-#endif
void BookmarkModel::SetURLStarred(const GURL& url,
const string16& title,
bool is_starred) {
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h
index 00730d7..7103615 100644
--- a/chrome/browser/bookmarks/bookmark_model.h
+++ b/chrome/browser/bookmarks/bookmark_model.h
@@ -289,15 +289,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService {
const string16& title,
const GURL& url);
- // TODO(munjal): Remove wstring overload once all code is moved to string16.
// Adds a url with a specific creation date.
-#if !defined(WCHAR_T_IS_UTF16)
- const BookmarkNode* AddURLWithCreationTime(const BookmarkNode* parent,
- int index,
- const std::wstring& title,
- const GURL& url,
- const base::Time& creation_time);
-#endif
const BookmarkNode* AddURLWithCreationTime(const BookmarkNode* parent,
int index,
const string16& title,
@@ -308,15 +300,9 @@ class BookmarkModel : public NotificationObserver, public BookmarkService {
// BookmarkNodeChildrenReordered method.
void SortChildren(const BookmarkNode* parent);
- // TODO(munjal): Remove wstring overload once all code is moved to string16.
// This is the convenience that makes sure the url is starred or not starred.
// If is_starred is false, all bookmarks for URL are removed. If is_starred is
// true and there are no bookmarks for url, a bookmark is created.
-#if !defined(WCHAR_T_IS_UTF16)
- void SetURLStarred(const GURL& url,
- const std::wstring& title,
- bool is_starred);
-#endif
void SetURLStarred(const GURL& url,
const string16& title,
bool is_starred);
diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc
index 4001d35..b1d5883 100644
--- a/chrome/browser/bookmarks/bookmark_model_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc
@@ -10,6 +10,7 @@
#include "base/file_util.h"
#include "base/hash_tables.h"
#include "base/path_service.h"
+#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_codec.h"
@@ -941,7 +942,7 @@ TEST_F(BookmarkModelTestWithProfile2, RemoveNotification) {
// Add a URL.
GURL url("http://www.google.com");
- bb_model_->SetURLStarred(url, std::wstring(), true);
+ bb_model_->SetURLStarred(url, string16(), true);
profile_->GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(
url, NULL, 1, GURL(), PageTransition::TYPED,