Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2283)

Unified Diff: chrome/browser/history/text_database_manager.cc

Issue 2714012: Convert page contents grabbing from wide to UTF16. The current code is a bit... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/text_database_manager.cc
===================================================================
--- chrome/browser/history/text_database_manager.cc (revision 49439)
+++ chrome/browser/history/text_database_manager.cc (working copy)
@@ -28,12 +28,16 @@
// The number of database files we will be attached to at once.
const int kCacheDBSize = 5;
-std::string ConvertStringForIndexer(
- const std::wstring& input) {
+std::string ConvertStringForIndexer(const std::wstring& input) {
// TODO(evanm): other transformations here?
Nico 2010/06/10 21:03:35 Should this call the string16 version?
brettw 2010/06/11 21:01:04 This is currently only used for titles. I'm OK hav
return WideToUTF8(CollapseWhitespace(input, false));
}
+std::string ConvertStringForIndexer(const string16& input) {
+ // TODO(evanm): other transformations here?
+ return UTF16ToUTF8(CollapseWhitespace(input, false));
+}
+
// Data older than this will be committed to the full text index even if we
// haven't gotten a title and/or body.
const int kExpirationSec = 20;
@@ -58,9 +62,9 @@
title_ = ttl;
}
-void TextDatabaseManager::PageInfo::set_body(const std::wstring& bdy) {
+void TextDatabaseManager::PageInfo::set_body(const string16& bdy) {
if (bdy.empty()) // Make the body nonempty when we set it for EverybodySet.
- body_ = L" ";
+ body_ = ASCIIToUTF16(" ");
else
body_ = bdy;
}
@@ -209,7 +213,7 @@
}
AddPageData(url, url_row.id(), visit.visit_id, visit.visit_time,
- title, std::wstring());
+ title, string16());
return; // We don't know about this page, give up.
}
@@ -226,7 +230,7 @@
}
void TextDatabaseManager::AddPageContents(const GURL& url,
- const std::wstring& body) {
+ const string16& body) {
RecentChangeList::iterator found = recent_changes_.Peek(url);
if (found == recent_changes_.end()) {
// This page is not in our cache of recent pages. This means that the page
@@ -266,7 +270,7 @@
VisitID visit_id,
Time visit_time,
const std::wstring& title,
- const std::wstring& body) {
+ const string16& body) {
TextDatabase* db = GetDBForTime(visit_time, true);
if (!db)
return false;

Powered by Google App Engine
This is Rietveld 408576698