summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/drive/drive_webapps_registry.cc19
-rw-r--r--chrome/browser/chromeos/drive/drive_webapps_registry.h4
-rw-r--r--chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc1
-rw-r--r--chrome/browser/chromeos/drive/resource_entry_conversion.cc4
-rw-r--r--chrome/browser/google_apis/fake_drive_service.cc4
-rw-r--r--chrome/browser/google_apis/fake_drive_service_unittest.cc15
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser.cc7
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser.h54
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser_unittest.cc33
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_client.cc23
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_client.h6
-rw-r--r--chrome/browser/sync_file_system/drive_file_sync_service.cc6
-rw-r--r--chrome/browser/sync_file_system/sync_file_system_service.cc2
13 files changed, 93 insertions, 85 deletions
diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.cc b/chrome/browser/chromeos/drive/drive_webapps_registry.cc
index fff7e86..9813d53 100644
--- a/chrome/browser/chromeos/drive/drive_webapps_registry.cc
+++ b/chrome/browser/chromeos/drive/drive_webapps_registry.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/drive/drive_webapps_registry.h"
#include <algorithm>
+#include <string>
#include <utility>
#include <vector>
@@ -247,11 +248,11 @@ void DriveWebAppsRegistry::UpdateFromAppList(
std::sort(document_icons.begin(), document_icons.end(), SortBySize);
url_to_name_map_.insert(
- std::make_pair(app.product_url(), UTF8ToUTF16(app.name())));
+ std::make_pair(app.product_url(), app.name()));
AddAppSelectorList(app.product_url(),
app_icons,
document_icons,
- UTF8ToUTF16(app.object_type()),
+ app.object_type(),
app.application_id(),
true, // primary
app.primary_mimetypes(),
@@ -259,7 +260,7 @@ void DriveWebAppsRegistry::UpdateFromAppList(
AddAppSelectorList(app.product_url(),
app_icons,
document_icons,
- UTF8ToUTF16(app.object_type()),
+ app.object_type(),
app.application_id(),
false, // primary
app.secondary_mimetypes(),
@@ -267,7 +268,7 @@ void DriveWebAppsRegistry::UpdateFromAppList(
AddAppSelectorList(app.product_url(),
app_icons,
document_icons,
- UTF8ToUTF16(app.object_type()),
+ app.object_type(),
app.application_id(),
true, // primary
app.primary_file_extensions(),
@@ -275,7 +276,7 @@ void DriveWebAppsRegistry::UpdateFromAppList(
AddAppSelectorList(app.product_url(),
app_icons,
document_icons,
- UTF8ToUTF16(app.object_type()),
+ app.object_type(),
app.application_id(),
false, // primary
app.secondary_file_extensions(),
@@ -288,7 +289,7 @@ void DriveWebAppsRegistry::AddAppSelectorList(
const GURL& product_link,
const google_apis::InstalledApp::IconList& app_icons,
const google_apis::InstalledApp::IconList& document_icons,
- const string16& object_type,
+ const std::string& object_type,
const std::string& app_id,
bool is_primary_selector,
const ScopedVector<std::string>& selectors,
@@ -300,7 +301,7 @@ void DriveWebAppsRegistry::AddAppSelectorList(
*value, new WebAppFileSelector(product_link,
app_icons,
document_icons,
- object_type,
+ UTF8ToUTF16(object_type),
app_id,
is_primary_selector)));
}
@@ -313,7 +314,7 @@ void DriveWebAppsRegistry::FindWebAppsForSelector(
for (WebAppFileSelectorMap::const_iterator it = map.find(file_selector);
it != map.end() && it->first == file_selector; ++it) {
const WebAppFileSelector* web_app = it->second;
- std::map<GURL, string16>::const_iterator product_iter =
+ std::map<GURL, std::string>::const_iterator product_iter =
url_to_name_map_.find(web_app->product_link);
if (product_iter == url_to_name_map_.end()) {
NOTREACHED();
@@ -333,7 +334,7 @@ void DriveWebAppsRegistry::FindWebAppsForSelector(
web_app->app_icons,
web_app->document_icons,
web_store_id,
- product_iter->second, // app name.
+ UTF8ToUTF16(product_iter->second), // app name.
web_app->object_type,
web_app->is_primary_selector)));
}
diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.h b/chrome/browser/chromeos/drive/drive_webapps_registry.h
index e907db5..60d3733 100644
--- a/chrome/browser/chromeos/drive/drive_webapps_registry.h
+++ b/chrome/browser/chromeos/drive/drive_webapps_registry.h
@@ -112,7 +112,7 @@ class DriveWebAppsRegistry {
const GURL& product_link,
const google_apis::InstalledApp::IconList& app_icons,
const google_apis::InstalledApp::IconList& document_icons,
- const string16& object_type,
+ const std::string& object_type,
const std::string& app_id,
bool is_primary_selector,
const ScopedVector<std::string>& selectors,
@@ -124,7 +124,7 @@ class DriveWebAppsRegistry {
SelectorWebAppList* apps);
// Map of web store product URL to application name.
- std::map<GURL, string16> url_to_name_map_;
+ std::map<GURL, std::string> url_to_name_map_;
// Map of filename extension to application info.
WebAppFileSelectorMap webapp_extension_map_;
diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc
index 239b432..fff37b3 100644
--- a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc
@@ -9,7 +9,6 @@
#include "base/json/json_file_value_serializer.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/chromeos/drive/drive_test_util.h"
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.cc b/chrome/browser/chromeos/drive/resource_entry_conversion.cc
index b6b63a0..8b55925 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion.cc
+++ b/chrome/browser/chromeos/drive/resource_entry_conversion.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
+#include <string>
+
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -23,7 +25,7 @@ DriveEntryProto ConvertResourceEntryToDriveEntryProto(
// may be different (e.g. due to rename). To be consistent with the web
// interface and other client to use the 'title' attribute, instead of
// 'filename', as the file name in the local snapshot.
- entry_proto.set_title(UTF16ToUTF8(entry.title()));
+ entry_proto.set_title(entry.title());
entry_proto.set_base_name(util::EscapeUtf8FileName(entry_proto.title()));
entry_proto.set_resource_id(entry.resource_id());
diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc
index 60b4888..b0c48fe 100644
--- a/chrome/browser/google_apis/fake_drive_service.cc
+++ b/chrome/browser/google_apis/fake_drive_service.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/google_apis/fake_drive_service.h"
+#include <string>
+
#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
@@ -52,7 +54,7 @@ bool EntryMatchWithQuery(const ResourceEntry& entry,
if (!key.empty() && key != "title")
return false;
// Search query in the title.
- if (UTF16ToUTF8(entry.title()).find(value) == std::string::npos)
+ if (entry.title().find(value) == std::string::npos)
return false;
}
return true;
diff --git a/chrome/browser/google_apis/fake_drive_service_unittest.cc b/chrome/browser/google_apis/fake_drive_service_unittest.cc
index bdc2fc0..ce76122 100644
--- a/chrome/browser/google_apis/fake_drive_service_unittest.cc
+++ b/chrome/browser/google_apis/fake_drive_service_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/google_apis/fake_drive_service.h"
+#include <string>
+
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop.h"
@@ -339,8 +341,7 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithNewEntry) {
ASSERT_TRUE(resource_list);
// The result should only contain the newly created directory.
ASSERT_EQ(1U, resource_list->entries().size());
- EXPECT_EQ("new directory",
- UTF16ToUTF8(resource_list->entries()[0]->title()));
+ EXPECT_EQ("new directory", resource_list->entries()[0]->title());
EXPECT_EQ(1, fake_service_.resource_list_load_count());
}
@@ -631,7 +632,7 @@ TEST_F(FakeDriveServiceTest, CopyHostedDocument_ExistingHostedDocument) {
ASSERT_TRUE(resource_entry);
// The copied entry should have the new resource ID and the title.
EXPECT_EQ(kResourceId + "_copied", resource_entry->resource_id());
- EXPECT_EQ("new name", UTF16ToUTF8(resource_entry->title()));
+ EXPECT_EQ("new name", resource_entry->title());
// Should be incremented as a new hosted document was created.
EXPECT_EQ(1, fake_service_.largest_changestamp());
}
@@ -708,7 +709,7 @@ TEST_F(FakeDriveServiceTest, RenameResource_ExistingFile) {
scoped_ptr<ResourceEntry> resource_entry = FindEntry(kResourceId);
ASSERT_TRUE(resource_entry);
- EXPECT_EQ("new name", UTF16ToUTF8(resource_entry->title()));
+ EXPECT_EQ("new name", resource_entry->title());
// Should be incremented as a file was renamed.
EXPECT_EQ(1, fake_service_.largest_changestamp());
}
@@ -934,7 +935,7 @@ TEST_F(FakeDriveServiceTest, AddNewDirectory_ToRootDirectory) {
EXPECT_EQ(HTTP_CREATED, error);
ASSERT_TRUE(resource_entry);
EXPECT_EQ("resource_id_1", resource_entry->resource_id());
- EXPECT_EQ("new directory", UTF16ToUTF8(resource_entry->title()));
+ EXPECT_EQ("new directory", resource_entry->title());
// The parent link should not exist as the new directory was added in the
// root.
const google_apis::Link* parent_link =
@@ -960,7 +961,7 @@ TEST_F(FakeDriveServiceTest, AddNewDirectory_ToRootDirectoryOnEmptyFileSystem) {
EXPECT_EQ(HTTP_CREATED, error);
ASSERT_TRUE(resource_entry);
EXPECT_EQ("resource_id_1", resource_entry->resource_id());
- EXPECT_EQ("new directory", UTF16ToUTF8(resource_entry->title()));
+ EXPECT_EQ("new directory", resource_entry->title());
// The parent link should not exist as the new directory was added in the
// root.
const google_apis::Link* parent_link =
@@ -988,7 +989,7 @@ TEST_F(FakeDriveServiceTest, AddNewDirectory_ToNonRootDirectory) {
EXPECT_EQ(HTTP_CREATED, error);
ASSERT_TRUE(resource_entry);
EXPECT_EQ("resource_id_1", resource_entry->resource_id());
- EXPECT_EQ("new directory", UTF16ToUTF8(resource_entry->title()));
+ EXPECT_EQ("new directory", resource_entry->title());
const google_apis::Link* parent_link =
resource_entry->GetLinkByType(Link::LINK_PARENT);
ASSERT_TRUE(parent_link);
diff --git a/chrome/browser/google_apis/gdata_wapi_parser.cc b/chrome/browser/google_apis/gdata_wapi_parser.cc
index 208da1f..36c0574 100644
--- a/chrome/browser/google_apis/gdata_wapi_parser.cc
+++ b/chrome/browser/google_apis/gdata_wapi_parser.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
#include <algorithm>
+#include <string>
#include "base/basictypes.h"
#include "base/file_path.h"
@@ -701,7 +702,7 @@ scoped_ptr<ResourceEntry> ResourceEntry::CreateFromFileResource(
entry->resource_id_ = file.file_id();
entry->id_ = file.file_id();
entry->kind_ = file.GetKind();
- entry->title_ = UTF8ToUTF16(file.title());
+ entry->title_ = file.title();
entry->published_time_ = file.created_date();
// TODO(kochi): entry->labels_
// This should be the url to download the file.
@@ -710,8 +711,8 @@ scoped_ptr<ResourceEntry> ResourceEntry::CreateFromFileResource(
// TODO(kochi): entry->feed_links_
// For file entries
- entry->filename_ = UTF8ToUTF16(file.title());
- entry->suggested_filename_ = UTF8ToUTF16(file.title());
+ entry->filename_ = file.title();
+ entry->suggested_filename_ = file.title();
entry->file_md5_ = file.md5_checksum();
entry->file_size_ = file.file_size();
diff --git a/chrome/browser/google_apis/gdata_wapi_parser.h b/chrome/browser/google_apis/gdata_wapi_parser.h
index 3ed6637..ec9bbff 100644
--- a/chrome/browser/google_apis/gdata_wapi_parser.h
+++ b/chrome/browser/google_apis/gdata_wapi_parser.h
@@ -87,7 +87,7 @@ class Link {
const GURL& href() const { return href_; }
// Title of the link.
- const string16& title() const { return title_; }
+ const std::string& title() const { return title_; }
// For OPEN_WITH links, this contains the application ID. For all other link
// types, it is the empty string.
@@ -98,7 +98,7 @@ class Link {
void set_type(LinkType type) { type_ = type; }
void set_href(const GURL& href) { href_ = href; }
- void set_title(const string16& title) { title_ = title; }
+ void set_title(const std::string& title) { title_ = title; }
void set_app_id(const std::string& app_id) { app_id_ = app_id; }
void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; }
@@ -116,7 +116,7 @@ class Link {
LinkType type_;
GURL href_;
- string16 title_;
+ std::string title_;
std::string app_id_;
std::string mime_type_;
@@ -173,16 +173,16 @@ class Author {
base::JSONValueConverter<Author>* converter);
// Getters.
- const string16& name() const { return name_; }
+ const std::string& name() const { return name_; }
const std::string& email() const { return email_; }
- void set_name(const string16& name) { name_ = name; }
+ void set_name(const std::string& name) { name_ = name; }
void set_email(const std::string& email) { email_ = email; }
private:
friend class ResourceEntry;
- string16 name_;
+ std::string name_;
std::string email_;
DISALLOW_COPY_AND_ASSIGN(Author);
@@ -206,7 +206,7 @@ class Category {
base::JSONValueConverter<Category>* converter);
// Category label.
- const string16& label() const { return label_; }
+ const std::string& label() const { return label_; }
// Category type.
CategoryType type() const { return type_; }
@@ -214,7 +214,7 @@ class Category {
// Category term.
const std::string& term() const { return term_; }
- void set_label(const string16& label) { label_ = label; }
+ void set_label(const std::string& label) { label_ = label; }
void set_type(CategoryType type) { type_ = type; }
void set_term(const std::string& term) { term_ = term; }
@@ -227,7 +227,7 @@ class Category {
static bool GetCategoryTypeFromScheme(
const base::StringPiece& scheme, CategoryType* result);
- string16 label_;
+ std::string label_;
CategoryType type_;
std::string term_;
@@ -438,10 +438,10 @@ class ResourceEntry : public FeedEntry {
const std::string& id() const { return id_; }
DriveEntryKind kind() const { return kind_; }
- const string16& title() const { return title_; }
+ const std::string& title() const { return title_; }
base::Time published_time() const { return published_time_; }
base::Time last_viewed_time() const { return last_viewed_time_; }
- const std::vector<string16>& labels() const { return labels_; }
+ const std::vector<std::string>& labels() const { return labels_; }
// Content URL is the main URL of a resource, used to perform
// non-destructive operations like downloading a file. Search for
@@ -456,10 +456,10 @@ class ResourceEntry : public FeedEntry {
const ScopedVector<FeedLink>& feed_links() const { return feed_links_; }
// File name (exists only for kinds FILE and PDF).
- const string16& filename() const { return filename_; }
+ const std::string& filename() const { return filename_; }
// Suggested file name (exists only for kinds FILE and PDF).
- const string16& suggested_filename() const { return suggested_filename_; }
+ const std::string& suggested_filename() const { return suggested_filename_; }
// File content MD5 (exists only for kinds FILE and PDF).
const std::string& file_md5() const { return file_md5_; }
@@ -530,14 +530,14 @@ class ResourceEntry : public FeedEntry {
}
void set_id(const std::string& id) { id_ = id; }
void set_kind(DriveEntryKind kind) { kind_ = kind; }
- void set_title(const string16& title) { title_ = title; }
+ void set_title(const std::string& title) { title_ = title; }
void set_published_time(const base::Time& published_time) {
published_time_ = published_time;
}
void set_last_viewed_time(const base::Time& last_viewed_time) {
last_viewed_time_ = last_viewed_time;
}
- void set_labels(const std::vector<string16>& labels) {
+ void set_labels(const std::vector<std::string>& labels) {
labels_ = labels;
}
void set_content(const Content& content) {
@@ -546,8 +546,8 @@ class ResourceEntry : public FeedEntry {
void set_feed_links(ScopedVector<FeedLink>* feed_links) {
feed_links_.swap(*feed_links);
}
- void set_filename(const string16& filename) { filename_ = filename; }
- void set_suggested_filename(const string16& suggested_filename) {
+ void set_filename(const std::string& filename) { filename_ = filename; }
+ void set_suggested_filename(const std::string& suggested_filename) {
suggested_filename_ = suggested_filename;
}
void set_file_md5(const std::string& file_md5) { file_md5_ = file_md5; }
@@ -572,16 +572,16 @@ class ResourceEntry : public FeedEntry {
std::string resource_id_;
std::string id_;
DriveEntryKind kind_;
- string16 title_;
+ std::string title_;
base::Time published_time_;
// Last viewed value may be unreliable. See: crbug.com/152628.
base::Time last_viewed_time_;
- std::vector<string16> labels_;
+ std::vector<std::string> labels_;
Content content_;
ScopedVector<FeedLink> feed_links_;
// Optional fields for files only.
- string16 filename_;
- string16 suggested_filename_;
+ std::string filename_;
+ std::string suggested_filename_;
std::string file_md5_;
int64 file_size_;
bool deleted_;
@@ -691,13 +691,13 @@ class InstalledApp {
virtual ~InstalledApp();
// WebApp name.
- const string16& app_name() const { return app_name_; }
+ const std::string& app_name() const { return app_name_; }
// Drive app id
const std::string& app_id() const { return app_id_; }
// Object (file) type name that is generated by this WebApp.
- const string16& object_type() const { return object_type_; }
+ const std::string& object_type() const { return object_type_; }
// True if WebApp supports creation of new file instances.
bool supports_create() const { return supports_create_; }
@@ -751,8 +751,8 @@ class InstalledApp {
base::JSONValueConverter<InstalledApp>* converter);
void set_app_id(const std::string& app_id) { app_id_ = app_id; }
- void set_app_name(const string16& app_name) { app_name_ = app_name; }
- void set_object_type(const string16& object_type) {
+ void set_app_name(const std::string& app_name) { app_name_ = app_name; }
+ void set_object_type(const std::string& object_type) {
object_type_ = object_type;
}
void set_supports_create(bool supports_create) {
@@ -785,8 +785,8 @@ class InstalledApp {
std::string* result);
std::string app_id_;
- string16 app_name_;
- string16 object_type_;
+ std::string app_name_;
+ std::string object_type_;
bool supports_create_;
ScopedVector<std::string> primary_mimetypes_;
ScopedVector<std::string> secondary_mimetypes_;
diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
index c2c4dd0..cfb325a 100644
--- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
@@ -4,12 +4,13 @@
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
+#include <string>
+
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
#include "base/path_service.h"
-#include "base/string16.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -45,7 +46,7 @@ TEST(GDataWAPIParserTest, ResourceListJsonParser) {
// Check authors.
ASSERT_EQ(1U, feed->authors().size());
- EXPECT_EQ(ASCIIToUTF16("tester"), feed->authors()[0]->name());
+ EXPECT_EQ("tester", feed->authors()[0]->name());
EXPECT_EQ("tester@testing.com", feed->authors()[0]->email());
// Check links.
@@ -72,7 +73,7 @@ TEST(GDataWAPIParserTest, ResourceListJsonParser) {
EXPECT_EQ("\"HhMOFgcNHSt7ImBr\"", folder_entry->etag());
EXPECT_EQ("folder:sub_sub_directory_folder_id", folder_entry->resource_id());
EXPECT_EQ("https://1_folder_id", folder_entry->id());
- EXPECT_EQ(ASCIIToUTF16("Entry 1 Title"), folder_entry->title());
+ EXPECT_EQ("Entry 1 Title", folder_entry->title());
base::Time entry1_update_time;
base::Time entry1_publish_time;
ASSERT_TRUE(util::GetTimeFromString("2011-04-01T18:34:08.234Z",
@@ -83,7 +84,7 @@ TEST(GDataWAPIParserTest, ResourceListJsonParser) {
EXPECT_EQ(entry1_publish_time, folder_entry->published_time());
ASSERT_EQ(1U, folder_entry->authors().size());
- EXPECT_EQ(ASCIIToUTF16("entry_tester"), folder_entry->authors()[0]->name());
+ EXPECT_EQ("entry_tester", folder_entry->authors()[0]->name());
EXPECT_EQ("entry_tester@testing.com", folder_entry->authors()[0]->email());
EXPECT_EQ("https://1_folder_content_url/",
folder_entry->content_url().spec());
@@ -111,16 +112,15 @@ TEST(GDataWAPIParserTest, ResourceListJsonParser) {
const ResourceEntry* file_entry = feed->entries()[1];
ASSERT_TRUE(file_entry);
EXPECT_EQ(ENTRY_KIND_FILE, file_entry->kind());
- EXPECT_EQ(ASCIIToUTF16("filename.m4a"), file_entry->filename());
- EXPECT_EQ(ASCIIToUTF16("sugg_file_name.m4a"),
- file_entry->suggested_filename());
+ EXPECT_EQ("filename.m4a", file_entry->filename());
+ EXPECT_EQ("sugg_file_name.m4a", file_entry->suggested_filename());
EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", file_entry->file_md5());
EXPECT_EQ(892721, file_entry->file_size());
const Link* file_parent_link = file_entry->GetLinkByType(Link::LINK_PARENT);
ASSERT_TRUE(file_parent_link);
EXPECT_EQ("https://file_link_parent/", file_parent_link->href().spec());
EXPECT_EQ("application/atom+xml", file_parent_link->mime_type());
- EXPECT_EQ(ASCIIToUTF16("Medical"), file_parent_link->title());
+ EXPECT_EQ("Medical", file_parent_link->title());
const Link* file_open_with_link =
file_entry->GetLinkByType(Link::LINK_OPEN_WITH);
ASSERT_TRUE(file_open_with_link);
@@ -169,7 +169,7 @@ TEST(GDataWAPIParserTest, ResourceEntryJsonParser) {
EXPECT_EQ("\"HhMOFgxXHit7ImBr\"", entry->etag());
EXPECT_EQ("file:2_file_resource_id", entry->resource_id());
EXPECT_EQ("2_file_id", entry->id());
- EXPECT_EQ(ASCIIToUTF16("File 1.mp3"), entry->title());
+ EXPECT_EQ("File 1.mp3", entry->title());
base::Time entry1_update_time;
base::Time entry1_publish_time;
ASSERT_TRUE(util::GetTimeFromString("2011-12-14T00:40:47.330Z",
@@ -180,7 +180,7 @@ TEST(GDataWAPIParserTest, ResourceEntryJsonParser) {
EXPECT_EQ(entry1_publish_time, entry->published_time());
EXPECT_EQ(1U, entry->authors().size());
- EXPECT_EQ(ASCIIToUTF16("tester"), entry->authors()[0]->name());
+ EXPECT_EQ("tester", entry->authors()[0]->name());
EXPECT_EQ("tester@testing.com", entry->authors()[0]->email());
EXPECT_EQ("https://file_content_url/",
entry->content_url().spec());
@@ -232,9 +232,8 @@ TEST(GDataWAPIParserTest, ResourceEntryJsonParser) {
// Check a file properties.
EXPECT_EQ(ENTRY_KIND_FILE, entry->kind());
- EXPECT_EQ(ASCIIToUTF16("File 1.mp3"), entry->filename());
- EXPECT_EQ(ASCIIToUTF16("File 1.mp3"),
- entry->suggested_filename());
+ EXPECT_EQ("File 1.mp3", entry->filename());
+ EXPECT_EQ("File 1.mp3", entry->suggested_filename());
EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", entry->file_md5());
EXPECT_EQ(892721, entry->file_size());
}
@@ -260,8 +259,8 @@ TEST(GDataWAPIParserTest, AccountMetadataFeedParser) {
const InstalledApp* second_app = feed->installed_apps()[1];
ASSERT_TRUE(first_app);
- EXPECT_EQ("Drive App 1", UTF16ToUTF8(first_app->app_name()));
- EXPECT_EQ("Drive App Object 1", UTF16ToUTF8(first_app->object_type()));
+ EXPECT_EQ("Drive App 1", first_app->app_name());
+ EXPECT_EQ("Drive App Object 1", first_app->object_type());
EXPECT_TRUE(first_app->supports_create());
EXPECT_EQ("https://chrome.google.com/webstore/detail/abcdefabcdef",
first_app->GetProductUrl().spec());
@@ -295,8 +294,8 @@ TEST(GDataWAPIParserTest, AccountMetadataFeedParser) {
EXPECT_TRUE(icons.empty());
ASSERT_TRUE(second_app);
- EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name()));
- EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type()));
+ EXPECT_EQ("Drive App 2", second_app->app_name());
+ EXPECT_EQ("Drive App Object 2", second_app->object_type());
EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef",
second_app->GetProductUrl().spec());
EXPECT_FALSE(second_app->supports_create());
diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc
index 7bd5c67..434d1b1 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_client.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/sync_file_system/drive_file_sync_client.h"
#include <sstream>
+#include <string>
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -51,7 +52,7 @@ bool HasParentLinkTo(const ScopedVector<google_apis::Link>& links,
struct TitleAndParentQuery
: std::unary_function<const google_apis::ResourceEntry*, bool> {
- TitleAndParentQuery(const string16& title,
+ TitleAndParentQuery(const std::string& title,
const GURL& parent_link)
: title(title),
parent_link(parent_link) {
@@ -62,13 +63,13 @@ struct TitleAndParentQuery
HasParentLinkTo(entry->links(), parent_link);
}
- const string16& title;
+ const std::string& title;
const GURL& parent_link;
};
void FilterEntriesByTitleAndParent(
ScopedVector<google_apis::ResourceEntry>* entries,
- const string16& title,
+ const std::string& title,
const GURL& parent_link) {
typedef ScopedVector<google_apis::ResourceEntry>::iterator iterator;
iterator itr = std::partition(entries->begin(), entries->end(),
@@ -78,7 +79,7 @@ void FilterEntriesByTitleAndParent(
google_apis::ResourceEntry* GetDocumentByTitleAndParent(
const ScopedVector<google_apis::ResourceEntry>& entries,
- const string16& title,
+ const std::string& title,
const GURL& parent_link) {
typedef ScopedVector<google_apis::ResourceEntry>::const_iterator iterator;
iterator found = std::find_if(entries.begin(), entries.end(),
@@ -203,7 +204,7 @@ void DriveFileSyncClient::DidGetDirectory(
GURL parent_link;
if (!parent_resource_id.empty())
parent_link = ResourceIdToResourceLink(parent_resource_id);
- string16 title(ASCIIToUTF16(directory_name));
+ std::string title(directory_name);
google_apis::ResourceEntry* entry = GetDocumentByTitleAndParent(
feed->entries(), title, parent_link);
if (!entry) {
@@ -221,14 +222,14 @@ void DriveFileSyncClient::DidGetDirectory(
// TODO(tzik): Handle error.
DCHECK_EQ(google_apis::ENTRY_KIND_FOLDER, entry->kind());
- DCHECK_EQ(ASCIIToUTF16(directory_name), entry->title());
+ DCHECK_EQ(directory_name, entry->title());
callback.Run(error, entry->resource_id());
}
void DriveFileSyncClient::DidCreateDirectory(
const std::string& parent_resource_id,
- const string16& title,
+ const std::string& title,
const ResourceIdCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceEntry> entry) {
@@ -572,7 +573,7 @@ void DriveFileSyncClient::DidUploadNewFile(
}
EnsureTitleUniqueness(
- parent_resource_id, UTF8ToUTF16(title),
+ parent_resource_id, title,
base::Bind(&DriveFileSyncClient::DidEnsureUniquenessForCreateFile,
AsWeakPtr(), entry->resource_id(), callback));
}
@@ -701,19 +702,19 @@ void DriveFileSyncClient::DidDeleteFile(
void DriveFileSyncClient::EnsureTitleUniqueness(
const std::string& parent_resource_id,
- const string16& expected_title,
+ const std::string& expected_title,
const ResourceEntryCallback& callback) {
DCHECK(CalledOnValidThread());
SearchFilesInDirectory(
parent_resource_id,
- FormatTitleQuery(UTF16ToUTF8(expected_title)),
+ FormatTitleQuery(expected_title),
base::Bind(&DriveFileSyncClient::DidListEntriesToEnsureUniqueness,
AsWeakPtr(), parent_resource_id, expected_title, callback));
}
void DriveFileSyncClient::DidListEntriesToEnsureUniqueness(
const std::string& parent_resource_id,
- const string16& expected_title,
+ const std::string& expected_title,
const ResourceEntryCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceList> feed) {
diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.h b/chrome/browser/sync_file_system/drive_file_sync_client.h
index 966247d..14588b9 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_client.h
+++ b/chrome/browser/sync_file_system/drive_file_sync_client.h
@@ -200,7 +200,7 @@ class DriveFileSyncClient
scoped_ptr<google_apis::ResourceList> feed);
void DidCreateDirectory(const std::string& parent_resource_id,
- const string16& title,
+ const std::string& title,
const ResourceIdCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceEntry> entry);
@@ -275,11 +275,11 @@ class DriveFileSyncClient
google_apis::GDataErrorCode error);
void EnsureTitleUniqueness(const std::string& parent_resource_id,
- const string16& expected_title,
+ const std::string& expected_title,
const ResourceEntryCallback& callback);
void DidListEntriesToEnsureUniqueness(
const std::string& parent_resource_id,
- const string16& expected_title,
+ const std::string& expected_title,
const ResourceEntryCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceList> feed);
diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc
index 69d8848..bb80a68 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/sync_file_system/drive_file_sync_service.h"
#include <algorithm>
+#include <string>
#include <utility>
#include "base/bind.h"
@@ -1642,7 +1643,7 @@ bool DriveFileSyncService::AppendRemoteChange(
int64 changestamp,
RemoteSyncType sync_type) {
// TODO(tzik): Normalize the path here.
- FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(entry.title()));
+ FilePath path = FilePath::FromUTF8Unsafe(entry.title());
DCHECK(!entry.is_folder());
return AppendRemoteChangeInternal(
origin, path, entry.deleted(),
@@ -1871,8 +1872,7 @@ bool DriveFileSyncService::GetOriginForEntry(
itr != entry.links().end(); ++itr) {
if ((*itr)->type() != google_apis::Link::LINK_PARENT)
continue;
- GURL origin(DriveFileSyncClient::DirectoryTitleToOrigin(
- UTF16ToUTF8((*itr)->title())));
+ GURL origin(DriveFileSyncClient::DirectoryTitleToOrigin((*itr)->title()));
DCHECK(origin.is_valid());
if (!metadata_store_->IsBatchSyncOrigin(origin) &&
diff --git a/chrome/browser/sync_file_system/sync_file_system_service.cc b/chrome/browser/sync_file_system/sync_file_system_service.cc
index 565c0e5..83903c5 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/sync_file_system/sync_file_system_service.h"
+#include <string>
+
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"