diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 19:21:31 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 19:21:31 +0000 |
commit | 8275835e508fb36328dd79c338d31bbf98eadf56 (patch) | |
tree | f78d6d976f6bad03de09a82d550943068db096a3 /webkit | |
parent | 460d2fd0876fddb9e6a2a17cba9c70beb93dfa03 (diff) | |
download | chromium_src-8275835e508fb36328dd79c338d31bbf98eadf56.zip chromium_src-8275835e508fb36328dd79c338d31bbf98eadf56.tar.gz chromium_src-8275835e508fb36328dd79c338d31bbf98eadf56.tar.bz2 |
Replace string16 with base::string16 in src/webkit
BUG=
Review URL: https://codereview.chromium.org/13219005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
111 files changed, 764 insertions, 712 deletions
diff --git a/webkit/appcache/manifest_parser.cc b/webkit/appcache/manifest_parser.cc index eb16d8b..0d98d1e 100644 --- a/webkit/appcache/manifest_parser.cc +++ b/webkit/appcache/manifest_parser.cc @@ -57,7 +57,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, // http://www.w3.org/TR/html5/offline.html // Do not modify it without consulting those docs. // Though you might be tempted to convert these wstrings to UTF-8 or - // string16, this implementation seems simpler given the constraints. + // base::string16, this implementation seems simpler given the constraints. const wchar_t kSignature[] = L"CACHE MANIFEST"; const size_t kSignatureLength = arraysize(kSignature) - 1; @@ -162,7 +162,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, while (line_p < line_end && *line_p != '\t' && *line_p != ' ') ++line_p; - string16 url16; + base::string16 url16; WideToUTF16(line.c_str(), line_p - line.c_str(), &url16); GURL url = manifest_url.Resolve(url16); if (!url.is_valid()) @@ -205,7 +205,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, if (line_p == line_end) continue; // There was no whitespace separating the URLs. - string16 namespace_url16; + base::string16 namespace_url16; WideToUTF16(line.c_str(), line_p - line.c_str(), &namespace_url16); GURL namespace_url = manifest_url.Resolve(namespace_url16); if (!namespace_url.is_valid()) @@ -244,7 +244,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, while (line_p < line_end && *line_p != '\t' && *line_p != ' ') ++line_p; - string16 target_url16; + base::string16 target_url16; WideToUTF16(target_url_start, line_p - target_url_start, &target_url16); GURL target_url = manifest_url.Resolve(target_url16); if (!target_url.is_valid()) @@ -273,7 +273,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, continue; } - string16 namespace_url16; + base::string16 namespace_url16; WideToUTF16(line.c_str(), line_p - line.c_str(), &namespace_url16); GURL namespace_url = manifest_url.Resolve(namespace_url16); if (!namespace_url.is_valid()) @@ -299,7 +299,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, while (line_p < line_end && *line_p != '\t' && *line_p != ' ') ++line_p; - string16 fallback_url16; + base::string16 fallback_url16; WideToUTF16(fallback_start, line_p - fallback_start, &fallback_url16); GURL fallback_url = manifest_url.Resolve(fallback_url16); if (!fallback_url.is_valid()) diff --git a/webkit/compositor_bindings/web_layer_impl.cc b/webkit/compositor_bindings/web_layer_impl.cc index e7292e2..c540688 100644 --- a/webkit/compositor_bindings/web_layer_impl.cc +++ b/webkit/compositor_bindings/web_layer_impl.cc @@ -165,7 +165,8 @@ void WebLayerImpl::setFilter(SkImageFilter* filter) { } void WebLayerImpl::setDebugName(WebKit::WebString name) { - layer_->SetDebugName(UTF16ToASCII(string16(name.data(), name.length()))); + layer_->SetDebugName( + UTF16ToASCII(base::string16(name.data(), name.length()))); } void WebLayerImpl::setAnimationDelegate( diff --git a/webkit/database/database_connections.cc b/webkit/database/database_connections.cc index f6bbfd2..f2c19a1 100644 --- a/webkit/database/database_connections.cc +++ b/webkit/database/database_connections.cc @@ -24,8 +24,8 @@ bool DatabaseConnections::IsEmpty() const { } bool DatabaseConnections::IsDatabaseOpened( - const string16& origin_identifier, - const string16& database_name) const { + const base::string16& origin_identifier, + const base::string16& database_name) const { OriginConnections::const_iterator origin_it = connections_.find(origin_identifier); if (origin_it == connections_.end()) @@ -35,18 +35,20 @@ bool DatabaseConnections::IsDatabaseOpened( } bool DatabaseConnections::IsOriginUsed( - const string16& origin_identifier) const { + const base::string16& origin_identifier) const { return (connections_.find(origin_identifier) != connections_.end()); } -bool DatabaseConnections::AddConnection(const string16& origin_identifier, - const string16& database_name) { +bool DatabaseConnections::AddConnection( + const base::string16& origin_identifier, + const base::string16& database_name) { int& count = connections_[origin_identifier][database_name].first; return ++count == 1; } -bool DatabaseConnections::RemoveConnection(const string16& origin_identifier, - const string16& database_name) { +bool DatabaseConnections::RemoveConnection( + const base::string16& origin_identifier, + const base::string16& database_name) { return RemoveConnectionsHelper(origin_identifier, database_name, 1); } @@ -56,7 +58,7 @@ void DatabaseConnections::RemoveAllConnections() { void DatabaseConnections::RemoveConnections( const DatabaseConnections& connections, - std::vector<std::pair<string16, string16> >* closed_dbs) { + std::vector<std::pair<base::string16, base::string16> >* closed_dbs) { for (OriginConnections::const_iterator origin_it = connections.connections_.begin(); origin_it != connections.connections_.end(); @@ -72,22 +74,22 @@ void DatabaseConnections::RemoveConnections( } int64 DatabaseConnections::GetOpenDatabaseSize( - const string16& origin_identifier, - const string16& database_name) const { + const base::string16& origin_identifier, + const base::string16& database_name) const { DCHECK(IsDatabaseOpened(origin_identifier, database_name)); return connections_[origin_identifier][database_name].second; } void DatabaseConnections::SetOpenDatabaseSize( - const string16& origin_identifier, - const string16& database_name, + const base::string16& origin_identifier, + const base::string16& database_name, int64 size) { DCHECK(IsDatabaseOpened(origin_identifier, database_name)); connections_[origin_identifier][database_name].second = size; } void DatabaseConnections::ListConnections( - std::vector<std::pair<string16, string16> > *list) const { + std::vector<std::pair<base::string16, base::string16> > *list) const { for (OriginConnections::const_iterator origin_it = connections_.begin(); origin_it != connections_.end(); @@ -101,8 +103,8 @@ void DatabaseConnections::ListConnections( } bool DatabaseConnections::RemoveConnectionsHelper( - const string16& origin_identifier, - const string16& database_name, + const base::string16& origin_identifier, + const base::string16& database_name, int num_connections) { OriginConnections::iterator origin_iterator = connections_.find(origin_identifier); @@ -144,16 +146,16 @@ bool DatabaseConnectionsWrapper::HasOpenConnections() { } void DatabaseConnectionsWrapper::AddOpenConnection( - const string16& origin_identifier, - const string16& database_name) { + const base::string16& origin_identifier, + const base::string16& database_name) { // We add to the collection immediately on any thread. base::AutoLock auto_lock(open_connections_lock_); open_connections_.AddConnection(origin_identifier, database_name); } void DatabaseConnectionsWrapper::RemoveOpenConnection( - const string16& origin_identifier, - const string16& database_name) { + const base::string16& origin_identifier, + const base::string16& database_name) { // But only remove from the collection on the main thread // so we can handle the waiting_for_dbs_to_close_ case. if (!main_thread_->BelongsToCurrentThread()) { diff --git a/webkit/database/database_connections.h b/webkit/database/database_connections.h index f49cb79..f6f0a92 100644 --- a/webkit/database/database_connections.h +++ b/webkit/database/database_connections.h @@ -25,43 +25,43 @@ class WEBKIT_STORAGE_EXPORT DatabaseConnections { ~DatabaseConnections(); bool IsEmpty() const; - bool IsDatabaseOpened(const string16& origin_identifier, - const string16& database_name) const; - bool IsOriginUsed(const string16& origin_identifier) const; + bool IsDatabaseOpened(const base::string16& origin_identifier, + const base::string16& database_name) const; + bool IsOriginUsed(const base::string16& origin_identifier) const; // Returns true if this is the first connection. - bool AddConnection(const string16& origin_identifier, - const string16& database_name); + bool AddConnection(const base::string16& origin_identifier, + const base::string16& database_name); // Returns true if the last connection was removed. - bool RemoveConnection(const string16& origin_identifier, - const string16& database_name); + bool RemoveConnection(const base::string16& origin_identifier, + const base::string16& database_name); void RemoveAllConnections(); void RemoveConnections( const DatabaseConnections& connections, - std::vector<std::pair<string16, string16> >* closed_dbs); + std::vector<std::pair<base::string16, base::string16> >* closed_dbs); // Database sizes can be kept only if IsDatabaseOpened returns true. - int64 GetOpenDatabaseSize(const string16& origin_identifier, - const string16& database_name) const; - void SetOpenDatabaseSize(const string16& origin_identifier, - const string16& database_name, + int64 GetOpenDatabaseSize(const base::string16& origin_identifier, + const base::string16& database_name) const; + void SetOpenDatabaseSize(const base::string16& origin_identifier, + const base::string16& database_name, int64 size); // Returns a list of the connections, <origin_id, name>. void ListConnections( - std::vector<std::pair<string16, string16> > *list) const; + std::vector<std::pair<base::string16, base::string16> > *list) const; private: // Mapping from name to <openCount, size> - typedef std::map<string16, std::pair<int, int64> > DBConnections; - typedef std::map<string16, DBConnections> OriginConnections; + typedef std::map<base::string16, std::pair<int, int64> > DBConnections; + typedef std::map<base::string16, DBConnections> OriginConnections; mutable OriginConnections connections_; // mutable for GetOpenDatabaseSize // Returns true if the last connection was removed. - bool RemoveConnectionsHelper(const string16& origin_identifier, - const string16& database_name, + bool RemoveConnectionsHelper(const base::string16& origin_identifier, + const base::string16& database_name, int num_connections); }; @@ -79,10 +79,10 @@ class WEBKIT_STORAGE_EXPORT DatabaseConnectionsWrapper bool HasOpenConnections(); // Add and Remove may be called on any thread. - void AddOpenConnection(const string16& origin_identifier, - const string16& database_name); - void RemoveOpenConnection(const string16& origin_identifier, - const string16& database_name); + void AddOpenConnection(const base::string16& origin_identifier, + const base::string16& database_name); + void RemoveOpenConnection(const base::string16& origin_identifier, + const base::string16& database_name); private: ~DatabaseConnectionsWrapper(); friend class base::RefCountedThreadSafe<DatabaseConnectionsWrapper>; diff --git a/webkit/database/database_connections_unittest.cc b/webkit/database/database_connections_unittest.cc index d0deb31..1443f12 100644 --- a/webkit/database/database_connections_unittest.cc +++ b/webkit/database/database_connections_unittest.cc @@ -14,7 +14,7 @@ namespace webkit_database { namespace { void RemoveConnectionTask( - const string16& origin_id, const string16& database_name, + const base::string16& origin_id, const base::string16& database_name, scoped_refptr<DatabaseConnectionsWrapper> obj, bool* did_task_execute) { *did_task_execute = true; @@ -22,8 +22,8 @@ void RemoveConnectionTask( } void ScheduleRemoveConnectionTask( - base::Thread* thread, const string16& origin_id, - const string16& database_name, + base::Thread* thread, const base::string16& origin_id, + const base::string16& database_name, scoped_refptr<DatabaseConnectionsWrapper> obj, bool* did_task_execute) { thread->message_loop()->PostTask( @@ -35,9 +35,9 @@ void ScheduleRemoveConnectionTask( } // anonymous namespace TEST(DatabaseConnectionsTest, DatabaseConnectionsTest) { - const string16 kOriginId(ASCIIToUTF16("origin_id")); - const string16 kName(ASCIIToUTF16("database_name")); - const string16 kName2(ASCIIToUTF16("database_name2")); + const base::string16 kOriginId(ASCIIToUTF16("origin_id")); + const base::string16 kName(ASCIIToUTF16("database_name")); + const base::string16 kName2(ASCIIToUTF16("database_name2")); const int64 kSize = 1000; DatabaseConnections connections; @@ -74,7 +74,7 @@ TEST(DatabaseConnectionsTest, DatabaseConnectionsTest) { another.AddConnection(kOriginId, kName); another.AddConnection(kOriginId, kName2); - std::vector<std::pair<string16, string16> > closed_dbs; + std::vector<std::pair<base::string16, base::string16> > closed_dbs; connections.RemoveConnections(another, &closed_dbs); EXPECT_EQ(1u, closed_dbs.size()); EXPECT_EQ(kOriginId, closed_dbs[0].first); @@ -97,8 +97,8 @@ TEST(DatabaseConnectionsTest, DatabaseConnectionsTest) { } TEST(DatabaseConnectionsTest, DatabaseConnectionsWrapperTest) { - const string16 kOriginId(ASCIIToUTF16("origin_id")); - const string16 kName(ASCIIToUTF16("database_name")); + const base::string16 kOriginId(ASCIIToUTF16("origin_id")); + const base::string16 kName(ASCIIToUTF16("database_name")); MessageLoop message_loop; scoped_refptr<DatabaseConnectionsWrapper> obj( diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc index 1f55d9a..840e367 100644 --- a/webkit/database/database_quota_client.cc +++ b/webkit/database/database_quota_client.cc @@ -36,9 +36,9 @@ int64 GetOriginUsageOnDBThread( void GetOriginsOnDBThread( DatabaseTracker* db_tracker, std::set<GURL>* origins_ptr) { - std::vector<string16> origin_identifiers; + std::vector<base::string16> origin_identifiers; if (db_tracker->GetAllOriginIdentifiers(&origin_identifiers)) { - for (std::vector<string16>::const_iterator iter = + for (std::vector<base::string16>::const_iterator iter = origin_identifiers.begin(); iter != origin_identifiers.end(); ++iter) { GURL origin = DatabaseUtil::GetOriginFromIdentifier(*iter); @@ -51,9 +51,9 @@ void GetOriginsForHostOnDBThread( DatabaseTracker* db_tracker, std::set<GURL>* origins_ptr, const std::string& host) { - std::vector<string16> origin_identifiers; + std::vector<base::string16> origin_identifiers; if (db_tracker->GetAllOriginIdentifiers(&origin_identifiers)) { - for (std::vector<string16>::const_iterator iter = + for (std::vector<base::string16>::const_iterator iter = origin_identifiers.begin(); iter != origin_identifiers.end(); ++iter) { GURL origin = DatabaseUtil::GetOriginFromIdentifier(*iter); diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc index 631c20b..fca393d 100644 --- a/webkit/database/database_quota_client_unittest.cc +++ b/webkit/database/database_quota_client_unittest.cc @@ -32,7 +32,7 @@ class MockDatabaseTracker : public DatabaseTracker { async_delete_(false) {} virtual bool GetOriginInfo( - const string16& origin_identifier, + const base::string16& origin_identifier, OriginInfo* info) OVERRIDE { std::map<GURL, MockOriginInfo>::const_iterator found = mock_origin_infos_.find( @@ -44,7 +44,7 @@ class MockDatabaseTracker : public DatabaseTracker { } virtual bool GetAllOriginIdentifiers( - std::vector<string16>* origins_identifiers) OVERRIDE { + std::vector<base::string16>* origins_identifiers) OVERRIDE { std::map<GURL, MockOriginInfo>::const_iterator iter; for (iter = mock_origin_infos_.begin(); iter != mock_origin_infos_.end(); @@ -66,7 +66,7 @@ class MockDatabaseTracker : public DatabaseTracker { } virtual int DeleteDataForOrigin( - const string16& origin_id, + const base::string16& origin_id, const net::CompletionCallback& callback) OVERRIDE { ++delete_called_count_; if (async_delete()) { @@ -99,11 +99,11 @@ class MockDatabaseTracker : public DatabaseTracker { private: class MockOriginInfo : public OriginInfo { public: - void set_origin(const string16& origin_id) { + void set_origin(const base::string16& origin_id) { origin_ = origin_id; } - void AddMockDatabase(const string16& name, int size) { + void AddMockDatabase(const base::string16& name, int size) { EXPECT_TRUE(database_info_.find(name) == database_info_.end()); database_info_[name].first = size; total_size_ += size; diff --git a/webkit/database/database_tracker.cc b/webkit/database/database_tracker.cc index 3462ece..85fa262 100644 --- a/webkit/database/database_tracker.cc +++ b/webkit/database/database_tracker.cc @@ -51,29 +51,30 @@ OriginInfo::OriginInfo(const OriginInfo& origin_info) OriginInfo::~OriginInfo() {} -void OriginInfo::GetAllDatabaseNames(std::vector<string16>* databases) const { +void OriginInfo::GetAllDatabaseNames( + std::vector<base::string16>* databases) const { for (DatabaseInfoMap::const_iterator it = database_info_.begin(); it != database_info_.end(); it++) { databases->push_back(it->first); } } -int64 OriginInfo::GetDatabaseSize(const string16& database_name) const { +int64 OriginInfo::GetDatabaseSize(const base::string16& database_name) const { DatabaseInfoMap::const_iterator it = database_info_.find(database_name); if (it != database_info_.end()) return it->second.first; return 0; } -string16 OriginInfo::GetDatabaseDescription( - const string16& database_name) const { +base::string16 OriginInfo::GetDatabaseDescription( + const base::string16& database_name) const { DatabaseInfoMap::const_iterator it = database_info_.find(database_name); if (it != database_info_.end()) return it->second.second; - return string16(); + return base::string16(); } -OriginInfo::OriginInfo(const string16& origin, int64 total_size) +OriginInfo::OriginInfo(const base::string16& origin, int64 total_size) : origin_(origin), total_size_(total_size) {} DatabaseTracker::DatabaseTracker( @@ -108,9 +109,9 @@ DatabaseTracker::~DatabaseTracker() { DCHECK(deletion_callbacks_.empty()); } -void DatabaseTracker::DatabaseOpened(const string16& origin_identifier, - const string16& database_name, - const string16& database_description, +void DatabaseTracker::DatabaseOpened(const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& database_description, int64 estimated_size, int64* database_size) { if (shutting_down_ || !LazyInit()) { @@ -137,15 +138,15 @@ void DatabaseTracker::DatabaseOpened(const string16& origin_identifier, &database_description); } -void DatabaseTracker::DatabaseModified(const string16& origin_identifier, - const string16& database_name) { +void DatabaseTracker::DatabaseModified(const base::string16& origin_identifier, + const base::string16& database_name) { if (!LazyInit()) return; UpdateOpenDatabaseSizeAndNotify(origin_identifier, database_name); } -void DatabaseTracker::DatabaseClosed(const string16& origin_identifier, - const string16& database_name) { +void DatabaseTracker::DatabaseClosed(const base::string16& origin_identifier, + const base::string16& database_name) { if (database_connections_.IsEmpty()) { DCHECK(!is_initialized_); return; @@ -165,8 +166,8 @@ void DatabaseTracker::DatabaseClosed(const string16& origin_identifier, } void DatabaseTracker::HandleSqliteError( - const string16& origin_identifier, - const string16& database_name, + const base::string16& origin_identifier, + const base::string16& database_name, int error) { // We only handle errors that indicate corruption and we // do so with a heavy hand, we delete it. Any renderers/workers @@ -194,22 +195,23 @@ void DatabaseTracker::CloseDatabases(const DatabaseConnections& connections) { // We need to examine what we have in connections for the // size of each open databases and notify any differences between the // actual file sizes now. - std::vector<std::pair<string16, string16> > open_dbs; + std::vector<std::pair<base::string16, base::string16> > open_dbs; connections.ListConnections(&open_dbs); - for (std::vector<std::pair<string16, string16> >::iterator it = + for (std::vector<std::pair<base::string16, base::string16> >::iterator it = open_dbs.begin(); it != open_dbs.end(); ++it) UpdateOpenDatabaseSizeAndNotify(it->first, it->second); - std::vector<std::pair<string16, string16> > closed_dbs; + std::vector<std::pair<base::string16, base::string16> > closed_dbs; database_connections_.RemoveConnections(connections, &closed_dbs); - for (std::vector<std::pair<string16, string16> >::iterator it = + for (std::vector<std::pair<base::string16, base::string16> >::iterator it = closed_dbs.begin(); it != closed_dbs.end(); ++it) { DeleteDatabaseIfNeeded(it->first, it->second); } } -void DatabaseTracker::DeleteDatabaseIfNeeded(const string16& origin_identifier, - const string16& database_name) { +void DatabaseTracker::DeleteDatabaseIfNeeded( + const base::string16& origin_identifier, + const base::string16& database_name) { DCHECK(!database_connections_.IsDatabaseOpened(origin_identifier, database_name)); if (IsDatabaseScheduledForDeletion(origin_identifier, database_name)) { @@ -223,7 +225,7 @@ void DatabaseTracker::DeleteDatabaseIfNeeded(const string16& origin_identifier, DatabaseSet::iterator found_origin = callback->second.find(origin_identifier); if (found_origin != callback->second.end()) { - std::set<string16>& databases = found_origin->second; + std::set<base::string16>& databases = found_origin->second; databases.erase(database_name); if (databases.empty()) { callback->second.erase(found_origin); @@ -264,8 +266,8 @@ void DatabaseTracker::CloseTrackerDatabaseAndClearCaches() { } } -string16 DatabaseTracker::GetOriginDirectory( - const string16& origin_identifier) { +base::string16 DatabaseTracker::GetOriginDirectory( + const base::string16& origin_identifier) { if (!is_incognito_) return origin_identifier; @@ -274,15 +276,15 @@ string16 DatabaseTracker::GetOriginDirectory( if (it != incognito_origin_directories_.end()) return it->second; - string16 origin_directory = + base::string16 origin_directory = base::IntToString16(incognito_origin_directories_generator_++); incognito_origin_directories_[origin_identifier] = origin_directory; return origin_directory; } base::FilePath DatabaseTracker::GetFullDBFilePath( - const string16& origin_identifier, - const string16& database_name) { + const base::string16& origin_identifier, + const base::string16& database_name) { DCHECK(!origin_identifier.empty()); if (!LazyInit()) return base::FilePath(); @@ -298,7 +300,7 @@ base::FilePath DatabaseTracker::GetFullDBFilePath( UTF16ToWide(GetOriginDirectory(origin_identifier)))).Append(file_name); } -bool DatabaseTracker::GetOriginInfo(const string16& origin_identifier, +bool DatabaseTracker::GetOriginInfo(const base::string16& origin_identifier, OriginInfo* info) { DCHECK(info); CachedOriginInfo* cached_info = GetCachedOriginInfo(origin_identifier); @@ -309,7 +311,7 @@ bool DatabaseTracker::GetOriginInfo(const string16& origin_identifier, } bool DatabaseTracker::GetAllOriginIdentifiers( - std::vector<string16>* origin_identifiers) { + std::vector<base::string16>* origin_identifiers) { DCHECK(origin_identifiers); DCHECK(origin_identifiers->empty()); if (!LazyInit()) @@ -317,15 +319,16 @@ bool DatabaseTracker::GetAllOriginIdentifiers( return databases_table_->GetAllOrigins(origin_identifiers); } -bool DatabaseTracker::GetAllOriginsInfo(std::vector<OriginInfo>* origins_info) { +bool DatabaseTracker::GetAllOriginsInfo( + std::vector<OriginInfo>* origins_info) { DCHECK(origins_info); DCHECK(origins_info->empty()); - std::vector<string16> origins; + std::vector<base::string16> origins; if (!GetAllOriginIdentifiers(&origins)) return false; - for (std::vector<string16>::const_iterator it = origins.begin(); + for (std::vector<base::string16>::const_iterator it = origins.begin(); it != origins.end(); it++) { CachedOriginInfo* origin_info = GetCachedOriginInfo(*it); if (!origin_info) { @@ -339,8 +342,9 @@ bool DatabaseTracker::GetAllOriginsInfo(std::vector<OriginInfo>* origins_info) { return true; } -bool DatabaseTracker::DeleteClosedDatabase(const string16& origin_identifier, - const string16& database_name) { +bool DatabaseTracker::DeleteClosedDatabase( + const base::string16& origin_identifier, + const base::string16& database_name) { if (!LazyInit()) return false; @@ -381,7 +385,7 @@ bool DatabaseTracker::DeleteClosedDatabase(const string16& origin_identifier, return true; } -bool DatabaseTracker::DeleteOrigin(const string16& origin_identifier, +bool DatabaseTracker::DeleteOrigin(const base::string16& origin_identifier, bool force) { if (!LazyInit()) return false; @@ -434,13 +438,13 @@ bool DatabaseTracker::DeleteOrigin(const string16& origin_identifier, } bool DatabaseTracker::IsDatabaseScheduledForDeletion( - const string16& origin_identifier, - const string16& database_name) { + const base::string16& origin_identifier, + const base::string16& database_name) { DatabaseSet::iterator it = dbs_to_be_deleted_.find(origin_identifier); if (it == dbs_to_be_deleted_.end()) return false; - std::set<string16>& databases = it->second; + std::set<base::string16>& databases = it->second; return (databases.find(database_name) != databases.end()); } @@ -512,9 +516,9 @@ bool DatabaseTracker::UpgradeToCurrentVersion() { } void DatabaseTracker::InsertOrUpdateDatabaseDetails( - const string16& origin_identifier, - const string16& database_name, - const string16& database_description, + const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& database_description, int64 estimated_size) { DatabaseDetails details; if (!databases_table_->GetDatabaseDetails( @@ -537,7 +541,7 @@ void DatabaseTracker::ClearAllCachedOriginInfo() { } DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo( - const string16& origin_identifier, bool create_if_needed) { + const base::string16& origin_identifier, bool create_if_needed) { if (!LazyInit()) return NULL; @@ -572,8 +576,8 @@ DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo( return &origins_info_map_[origin_identifier]; } -int64 DatabaseTracker::GetDBFileSize(const string16& origin_identifier, - const string16& database_name) { +int64 DatabaseTracker::GetDBFileSize(const base::string16& origin_identifier, + const base::string16& database_name) { base::FilePath db_file_name = GetFullDBFilePath(origin_identifier, database_name); int64 db_file_size = 0; @@ -583,8 +587,8 @@ int64 DatabaseTracker::GetDBFileSize(const string16& origin_identifier, } int64 DatabaseTracker::SeedOpenDatabaseInfo( - const string16& origin_id, const string16& name, - const string16& description) { + const base::string16& origin_id, const base::string16& name, + const base::string16& description) { DCHECK(database_connections_.IsDatabaseOpened(origin_id, name)); int64 size = GetDBFileSize(origin_id, name); database_connections_.SetOpenDatabaseSize(origin_id, name, size); @@ -597,8 +601,8 @@ int64 DatabaseTracker::SeedOpenDatabaseInfo( } int64 DatabaseTracker::UpdateOpenDatabaseInfoAndNotify( - const string16& origin_id, const string16& name, - const string16* opt_description) { + const base::string16& origin_id, const base::string16& name, + const base::string16* opt_description) { DCHECK(database_connections_.IsDatabaseOpened(origin_id, name)); int64 new_size = GetDBFileSize(origin_id, name); int64 old_size = database_connections_.GetOpenDatabaseSize(origin_id, name); @@ -622,8 +626,8 @@ int64 DatabaseTracker::UpdateOpenDatabaseInfoAndNotify( } void DatabaseTracker::ScheduleDatabaseForDeletion( - const string16& origin_identifier, - const string16& database_name) { + const base::string16& origin_identifier, + const base::string16& database_name) { DCHECK(database_connections_.IsDatabaseOpened(origin_identifier, database_name)); dbs_to_be_deleted_[origin_identifier].insert(database_name); @@ -640,14 +644,14 @@ void DatabaseTracker::ScheduleDatabasesForDeletion( deletion_callbacks_.push_back(std::make_pair(callback, databases)); for (DatabaseSet::const_iterator ori = databases.begin(); ori != databases.end(); ++ori) { - for (std::set<string16>::const_iterator db = ori->second.begin(); + for (std::set<base::string16>::const_iterator db = ori->second.begin(); db != ori->second.end(); ++db) ScheduleDatabaseForDeletion(ori->first, *db); } } -int DatabaseTracker::DeleteDatabase(const string16& origin_identifier, - const string16& database_name, +int DatabaseTracker::DeleteDatabase(const base::string16& origin_identifier, + const base::string16& database_name, const net::CompletionCallback& callback) { if (!LazyInit()) return net::ERR_FAILED; @@ -674,11 +678,12 @@ int DatabaseTracker::DeleteDataModifiedSince( DatabaseSet to_be_deleted; - std::vector<string16> origins_identifiers; + std::vector<base::string16> origins_identifiers; if (!databases_table_->GetAllOrigins(&origins_identifiers)) return net::ERR_FAILED; int rv = net::OK; - for (std::vector<string16>::const_iterator ori = origins_identifiers.begin(); + for (std::vector<base::string16>::const_iterator ori = + origins_identifiers.begin(); ori != origins_identifiers.end(); ++ori) { if (special_storage_policy_.get() && special_storage_policy_->IsStorageProtected( @@ -716,7 +721,7 @@ int DatabaseTracker::DeleteDataModifiedSince( } int DatabaseTracker::DeleteDataForOrigin( - const string16& origin, const net::CompletionCallback& callback) { + const base::string16& origin, const net::CompletionCallback& callback) { if (!LazyInit()) return net::ERR_FAILED; @@ -742,7 +747,8 @@ int DatabaseTracker::DeleteDataForOrigin( } void DatabaseTracker::GetIncognitoFileHandle( - const string16& vfs_file_name, base::PlatformFile* file_handle) const { + const base::string16& vfs_file_name, + base::PlatformFile* file_handle) const { DCHECK(is_incognito_); FileHandlesMap::const_iterator it = incognito_file_handles_.find(vfs_file_name); @@ -753,7 +759,8 @@ void DatabaseTracker::GetIncognitoFileHandle( } void DatabaseTracker::SaveIncognitoFileHandle( - const string16& vfs_file_name, const base::PlatformFile& file_handle) { + const base::string16& vfs_file_name, + const base::PlatformFile& file_handle) { DCHECK(is_incognito_); DCHECK(incognito_file_handles_.find(vfs_file_name) == incognito_file_handles_.end()); @@ -761,7 +768,8 @@ void DatabaseTracker::SaveIncognitoFileHandle( incognito_file_handles_[vfs_file_name] = file_handle; } -bool DatabaseTracker::CloseIncognitoFileHandle(const string16& vfs_file_name) { +bool DatabaseTracker::CloseIncognitoFileHandle( + const base::string16& vfs_file_name) { DCHECK(is_incognito_); DCHECK(incognito_file_handles_.find(vfs_file_name) != incognito_file_handles_.end()); @@ -777,7 +785,7 @@ bool DatabaseTracker::CloseIncognitoFileHandle(const string16& vfs_file_name) { } bool DatabaseTracker::HasSavedIncognitoFileHandle( - const string16& vfs_file_name) const { + const base::string16& vfs_file_name) const { return (incognito_file_handles_.find(vfs_file_name) != incognito_file_handles_.end()); } @@ -810,10 +818,11 @@ void DatabaseTracker::ClearSessionOnlyOrigins() { if (!LazyInit()) return; - std::vector<string16> origin_identifiers; + std::vector<base::string16> origin_identifiers; GetAllOriginIdentifiers(&origin_identifiers); - for (std::vector<string16>::iterator origin = origin_identifiers.begin(); + for (std::vector<base::string16>::iterator origin = + origin_identifiers.begin(); origin != origin_identifiers.end(); ++origin) { GURL origin_url = webkit_database::DatabaseUtil::GetOriginFromIdentifier(*origin); @@ -822,11 +831,11 @@ void DatabaseTracker::ClearSessionOnlyOrigins() { if (special_storage_policy_->IsStorageProtected(origin_url)) continue; webkit_database::OriginInfo origin_info; - std::vector<string16> databases; + std::vector<base::string16> databases; GetOriginInfo(*origin, &origin_info); origin_info.GetAllDatabaseNames(&databases); - for (std::vector<string16>::iterator database = databases.begin(); + for (std::vector<base::string16>::iterator database = databases.begin(); database != databases.end(); ++database) { base::PlatformFile file_handle = base::CreatePlatformFile( GetFullDBFilePath(*origin, *database), diff --git a/webkit/database/database_tracker.h b/webkit/database/database_tracker.h index e11a8fe..d9f1e19 100644 --- a/webkit/database/database_tracker.h +++ b/webkit/database/database_tracker.h @@ -52,18 +52,20 @@ class WEBKIT_STORAGE_EXPORT OriginInfo { OriginInfo(const OriginInfo& origin_info); ~OriginInfo(); - const string16& GetOrigin() const { return origin_; } + const base::string16& GetOrigin() const { return origin_; } int64 TotalSize() const { return total_size_; } - void GetAllDatabaseNames(std::vector<string16>* databases) const; - int64 GetDatabaseSize(const string16& database_name) const; - string16 GetDatabaseDescription(const string16& database_name) const; + void GetAllDatabaseNames(std::vector<base::string16>* databases) const; + int64 GetDatabaseSize(const base::string16& database_name) const; + base::string16 GetDatabaseDescription( + const base::string16& database_name) const; protected: - typedef std::map<string16, std::pair<int64, string16> > DatabaseInfoMap; + typedef std::map<base::string16, std::pair<int64, base::string16> > + DatabaseInfoMap; - OriginInfo(const string16& origin, int64 total_size); + OriginInfo(const base::string16& origin, int64 total_size); - string16 origin_; + base::string16 origin_; int64 total_size_; DatabaseInfoMap database_info_; }; @@ -83,12 +85,12 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker public: class Observer { public: - virtual void OnDatabaseSizeChanged(const string16& origin_identifier, - const string16& database_name, + virtual void OnDatabaseSizeChanged(const base::string16& origin_identifier, + const base::string16& database_name, int64 database_size) = 0; virtual void OnDatabaseScheduledForDeletion( - const string16& origin_identifier, - const string16& database_name) = 0; + const base::string16& origin_identifier, + const base::string16& database_name) = 0; protected: virtual ~Observer() {} @@ -100,17 +102,17 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker quota::QuotaManagerProxy* quota_manager_proxy, base::MessageLoopProxy* db_tracker_thread); - void DatabaseOpened(const string16& origin_identifier, - const string16& database_name, - const string16& database_details, + void DatabaseOpened(const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& database_details, int64 estimated_size, int64* database_size); - void DatabaseModified(const string16& origin_identifier, - const string16& database_name); - void DatabaseClosed(const string16& origin_identifier, - const string16& database_name); - void HandleSqliteError(const string16& origin_identifier, - const string16& database_name, + void DatabaseModified(const base::string16& origin_identifier, + const base::string16& database_name); + void DatabaseClosed(const base::string16& origin_identifier, + const base::string16& database_name); + void HandleSqliteError(const base::string16& origin_identifier, + const base::string16& database_name, int error); void CloseDatabases(const DatabaseConnections& connections); @@ -121,12 +123,12 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker void CloseTrackerDatabaseAndClearCaches(); const base::FilePath& DatabaseDirectory() const { return db_dir_; } - base::FilePath GetFullDBFilePath(const string16& origin_identifier, - const string16& database_name); + base::FilePath GetFullDBFilePath(const base::string16& origin_identifier, + const base::string16& database_name); // virtual for unit-testing only - virtual bool GetOriginInfo(const string16& origin_id, OriginInfo* info); - virtual bool GetAllOriginIdentifiers(std::vector<string16>* origin_ids); + virtual bool GetOriginInfo(const base::string16& origin_id, OriginInfo* info); + virtual bool GetAllOriginIdentifiers(std::vector<base::string16>* origin_ids); virtual bool GetAllOriginsInfo(std::vector<OriginInfo>* origins_info); // Safe to call on any thread. @@ -134,14 +136,14 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker return quota_manager_proxy_.get(); } - bool IsDatabaseScheduledForDeletion(const string16& origin_identifier, - const string16& database_name); + bool IsDatabaseScheduledForDeletion(const base::string16& origin_identifier, + const base::string16& database_name); // Deletes a single database. Returns net::OK on success, net::FAILED on // failure, or net::ERR_IO_PENDING and |callback| is invoked upon completion, // if non-NULL. - int DeleteDatabase(const string16& origin_identifier, - const string16& database_name, + int DeleteDatabase(const base::string16& origin_identifier, + const base::string16& database_name, const net::CompletionCallback& callback); // Delete any databases that have been touched since the cutoff date that's @@ -157,17 +159,17 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker // success, net::FAILED if not all databases could be deleted, and // net::ERR_IO_PENDING and |callback| is invoked upon completion, if non-NULL. // virtual for unit testing only - virtual int DeleteDataForOrigin(const string16& origin_identifier, + virtual int DeleteDataForOrigin(const base::string16& origin_identifier, const net::CompletionCallback& callback); bool IsIncognitoProfile() const { return is_incognito_; } - void GetIncognitoFileHandle(const string16& vfs_file_path, + void GetIncognitoFileHandle(const base::string16& vfs_file_path, base::PlatformFile* file_handle) const; - void SaveIncognitoFileHandle(const string16& vfs_file_path, + void SaveIncognitoFileHandle(const base::string16& vfs_file_path, const base::PlatformFile& file_handle); - bool CloseIncognitoFileHandle(const string16& vfs_file_path); - bool HasSavedIncognitoFileHandle(const string16& vfs_file_path) const; + bool CloseIncognitoFileHandle(const base::string16& vfs_file_path); + bool HasSavedIncognitoFileHandle(const base::string16& vfs_file_path) const; // Shutdown the database tracker, deleting database files if the tracker is // used for an incognito profile. @@ -179,17 +181,17 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker friend class base::RefCountedThreadSafe<DatabaseTracker>; friend class MockDatabaseTracker; // for testing - typedef std::map<string16, std::set<string16> > DatabaseSet; + typedef std::map<base::string16, std::set<base::string16> > DatabaseSet; typedef std::vector<std::pair<net::CompletionCallback, DatabaseSet> > PendingDeletionCallbacks; - typedef std::map<string16, base::PlatformFile> FileHandlesMap; - typedef std::map<string16, string16> OriginDirectoriesMap; + typedef std::map<base::string16, base::PlatformFile> FileHandlesMap; + typedef std::map<base::string16, base::string16> OriginDirectoriesMap; class CachedOriginInfo : public OriginInfo { public: - CachedOriginInfo() : OriginInfo(string16(), 0) {} - void SetOrigin(const string16& origin) { origin_ = origin; } - void SetDatabaseSize(const string16& database_name, int64 new_size) { + CachedOriginInfo() : OriginInfo(base::string16(), 0) {} + void SetOrigin(const base::string16& origin) { origin_ = origin; } + void SetDatabaseSize(const base::string16& database_name, int64 new_size) { int64 old_size = 0; if (database_info_.find(database_name) != database_info_.end()) old_size = database_info_[database_name].first; @@ -197,8 +199,8 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker if (new_size != old_size) total_size_ += new_size - old_size; } - void SetDatabaseDescription(const string16& database_name, - const string16& description) { + void SetDatabaseDescription(const base::string16& database_name, + const base::string16& description) { database_info_[database_name].second = description; } }; @@ -212,54 +214,56 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker // Deletes session-only databases. Blocks databases from being created/opened. void ClearSessionOnlyOrigins(); - bool DeleteClosedDatabase(const string16& origin_identifier, - const string16& database_name); + bool DeleteClosedDatabase(const base::string16& origin_identifier, + const base::string16& database_name); // Delete all files belonging to the given origin given that no database // connections within this origin are open, or if |force| is true, delete // the meta data and rename the associated directory. - bool DeleteOrigin(const string16& origin_identifier, bool force); - void DeleteDatabaseIfNeeded(const string16& origin_identifier, - const string16& database_name); + bool DeleteOrigin(const base::string16& origin_identifier, bool force); + void DeleteDatabaseIfNeeded(const base::string16& origin_identifier, + const base::string16& database_name); bool LazyInit(); bool UpgradeToCurrentVersion(); - void InsertOrUpdateDatabaseDetails(const string16& origin_identifier, - const string16& database_name, - const string16& database_details, + void InsertOrUpdateDatabaseDetails(const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& database_details, int64 estimated_size); void ClearAllCachedOriginInfo(); - CachedOriginInfo* MaybeGetCachedOriginInfo(const string16& origin_identifier, - bool create_if_needed); - CachedOriginInfo* GetCachedOriginInfo(const string16& origin_identifier) { + CachedOriginInfo* MaybeGetCachedOriginInfo( + const base::string16& origin_identifier, + bool create_if_needed); + CachedOriginInfo* GetCachedOriginInfo( + const base::string16& origin_identifier) { return MaybeGetCachedOriginInfo(origin_identifier, true); } - int64 GetDBFileSize(const string16& origin_identifier, - const string16& database_name); - int64 SeedOpenDatabaseInfo(const string16& origin_identifier, - const string16& database_name, - const string16& description); - int64 UpdateOpenDatabaseInfoAndNotify(const string16& origin_identifier, - const string16& database_name, - const string16* opt_description); - int64 UpdateOpenDatabaseSizeAndNotify(const string16& origin_identifier, - const string16& database_name) { + int64 GetDBFileSize(const base::string16& origin_identifier, + const base::string16& database_name); + int64 SeedOpenDatabaseInfo(const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& description); + int64 UpdateOpenDatabaseInfoAndNotify(const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16* opt_description); + int64 UpdateOpenDatabaseSizeAndNotify(const base::string16& origin_identifier, + const base::string16& database_name) { return UpdateOpenDatabaseInfoAndNotify( origin_identifier, database_name, NULL); } - void ScheduleDatabaseForDeletion(const string16& origin_identifier, - const string16& database_name); + void ScheduleDatabaseForDeletion(const base::string16& origin_identifier, + const base::string16& database_name); // Schedule a set of open databases for deletion. If non-null, callback is // invoked upon completion. void ScheduleDatabasesForDeletion(const DatabaseSet& databases, const net::CompletionCallback& callback); // Returns the directory where all DB files for the given origin are stored. - string16 GetOriginDirectory(const string16& origin_identifier); + base::string16 GetOriginDirectory(const base::string16& origin_identifier); bool is_initialized_; const bool is_incognito_; @@ -271,7 +275,7 @@ class WEBKIT_STORAGE_EXPORT DatabaseTracker scoped_ptr<DatabasesTable> databases_table_; scoped_ptr<sql::MetaTable> meta_table_; ObserverList<Observer, true> observers_; - std::map<string16, CachedOriginInfo> origins_info_map_; + std::map<base::string16, CachedOriginInfo> origins_info_map_; DatabaseConnections database_connections_; // The set of databases that should be deleted but are still opened diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc index 193d3d7..44e86f7 100644 --- a/webkit/database/database_tracker_unittest.cc +++ b/webkit/database/database_tracker_unittest.cc @@ -39,8 +39,8 @@ class TestObserver : public webkit_database::DatabaseTracker::Observer { } virtual ~TestObserver() {} - virtual void OnDatabaseSizeChanged(const string16& origin_identifier, - const string16& database_name, + virtual void OnDatabaseSizeChanged(const base::string16& origin_identifier, + const base::string16& database_name, int64 database_size) OVERRIDE { if (!observe_size_changes_) return; @@ -50,8 +50,8 @@ class TestObserver : public webkit_database::DatabaseTracker::Observer { database_size_ = database_size; } virtual void OnDatabaseScheduledForDeletion( - const string16& origin_identifier, - const string16& database_name) OVERRIDE { + const base::string16& origin_identifier, + const base::string16& database_name) OVERRIDE { if (!observe_scheduled_deletions_) return; new_notification_received_ = true; @@ -63,22 +63,24 @@ class TestObserver : public webkit_database::DatabaseTracker::Observer { new_notification_received_ = false; return temp_new_notification_received; } - string16 GetNotificationOriginIdentifier() { return origin_identifier_; } - string16 GetNotificationDatabaseName() { return database_name_; } + base::string16 GetNotificationOriginIdentifier() { + return origin_identifier_; + } + base::string16 GetNotificationDatabaseName() { return database_name_; } int64 GetNotificationDatabaseSize() { return database_size_; } private: bool new_notification_received_; bool observe_size_changes_; bool observe_scheduled_deletions_; - string16 origin_identifier_; - string16 database_name_; + base::string16 origin_identifier_; + base::string16 database_name_; int64 database_size_; }; void CheckNotificationReceived(TestObserver* observer, - const string16& expected_origin_identifier, - const string16& expected_database_name, + const base::string16& expected_origin_identifier, + const base::string16& expected_database_name, int64 expected_database_size) { EXPECT_TRUE(observer->DidReceiveNewNotification()); EXPECT_EQ(expected_origin_identifier, @@ -199,14 +201,14 @@ class DatabaseTracker_TestHelper_Test { // Create and open three databases. int64 database_size = 0; - const string16 kOrigin1 = + const base::string16 kOrigin1 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); - const string16 kOrigin2 = + const base::string16 kOrigin2 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); - const string16 kDB1 = ASCIIToUTF16("db1"); - const string16 kDB2 = ASCIIToUTF16("db2"); - const string16 kDB3 = ASCIIToUTF16("db3"); - const string16 kDescription = ASCIIToUTF16("database_description"); + const base::string16 kDB1 = ASCIIToUTF16("db1"); + const base::string16 kDB2 = ASCIIToUTF16("db2"); + const base::string16 kDB3 = ASCIIToUTF16("db3"); + const base::string16 kDescription = ASCIIToUTF16("database_description"); tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0, &database_size); @@ -310,14 +312,14 @@ class DatabaseTracker_TestHelper_Test { // Open three new databases. int64 database_size = 0; - const string16 kOrigin1 = + const base::string16 kOrigin1 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); - const string16 kOrigin2 = + const base::string16 kOrigin2 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); - const string16 kDB1 = ASCIIToUTF16("db1"); - const string16 kDB2 = ASCIIToUTF16("db2"); - const string16 kDB3 = ASCIIToUTF16("db3"); - const string16 kDescription = ASCIIToUTF16("database_description"); + const base::string16 kDB1 = ASCIIToUTF16("db1"); + const base::string16 kDB2 = ASCIIToUTF16("db2"); + const base::string16 kDB3 = ASCIIToUTF16("db3"); + const base::string16 kDescription = ASCIIToUTF16("database_description"); // Get the info for kOrigin1 and kOrigin2 DatabaseTracker::CachedOriginInfo* origin1_info = @@ -438,9 +440,9 @@ class DatabaseTracker_TestHelper_Test { static void DatabaseTrackerQuotaIntegration() { const GURL kOrigin(kOrigin1Url); - const string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); - const string16 kName = ASCIIToUTF16("name"); - const string16 kDescription = ASCIIToUTF16("description"); + const base::string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); + const base::string16 kName = ASCIIToUTF16("name"); + const base::string16 kDescription = ASCIIToUTF16("description"); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -532,13 +534,13 @@ class DatabaseTracker_TestHelper_Test { static void DatabaseTrackerClearSessionOnlyDatabasesOnExit() { int64 database_size = 0; - const string16 kOrigin1 = + const base::string16 kOrigin1 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); - const string16 kOrigin2 = + const base::string16 kOrigin2 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); - const string16 kDB1 = ASCIIToUTF16("db1"); - const string16 kDB2 = ASCIIToUTF16("db2"); - const string16 kDescription = ASCIIToUTF16("database_description"); + const base::string16 kDB1 = ASCIIToUTF16("db1"); + const base::string16 kDB2 = ASCIIToUTF16("db2"); + const base::string16 kDescription = ASCIIToUTF16("database_description"); // Initialize the tracker database. MessageLoop message_loop; @@ -610,13 +612,13 @@ class DatabaseTracker_TestHelper_Test { static void DatabaseTrackerSetForceKeepSessionState() { int64 database_size = 0; - const string16 kOrigin1 = + const base::string16 kOrigin1 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); - const string16 kOrigin2 = + const base::string16 kOrigin2 = DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); - const string16 kDB1 = ASCIIToUTF16("db1"); - const string16 kDB2 = ASCIIToUTF16("db2"); - const string16 kDescription = ASCIIToUTF16("database_description"); + const base::string16 kDB1 = ASCIIToUTF16("db1"); + const base::string16 kDB2 = ASCIIToUTF16("db2"); + const base::string16 kDescription = ASCIIToUTF16("database_description"); // Initialize the tracker database. MessageLoop message_loop; @@ -686,10 +688,11 @@ class DatabaseTracker_TestHelper_Test { static void EmptyDatabaseNameIsValid() { const GURL kOrigin(kOrigin1Url); - const string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); - const string16 kEmptyName; - const string16 kDescription(ASCIIToUTF16("description")); - const string16 kChangedDescription(ASCIIToUTF16("changed_description")); + const base::string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); + const base::string16 kEmptyName; + const base::string16 kDescription(ASCIIToUTF16("description")); + const base::string16 kChangedDescription( + ASCIIToUTF16("changed_description")); // Initialize a tracker database, no need to put it on disk. const bool kUseInMemoryTrackerDatabase = true; @@ -733,9 +736,9 @@ class DatabaseTracker_TestHelper_Test { static void HandleSqliteError() { const GURL kOrigin(kOrigin1Url); - const string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); - const string16 kName(ASCIIToUTF16("name")); - const string16 kDescription(ASCIIToUTF16("description")); + const base::string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); + const base::string16 kName(ASCIIToUTF16("name")); + const base::string16 kDescription(ASCIIToUTF16("description")); // Initialize a tracker database, no need to put it on disk. const bool kUseInMemoryTrackerDatabase = true; diff --git a/webkit/database/database_util.cc b/webkit/database/database_util.cc index 8acccd2..2b56465 100644 --- a/webkit/database/database_util.cc +++ b/webkit/database/database_util.cc @@ -15,10 +15,10 @@ namespace webkit_database { const char DatabaseUtil::kJournalFileSuffix[] = "-journal"; -bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, - string16* origin_identifier, - string16* database_name, - string16* sqlite_suffix) { +bool DatabaseUtil::CrackVfsFileName(const base::string16& vfs_file_name, + base::string16* origin_identifier, + base::string16* database_name, + base::string16* sqlite_suffix) { // 'vfs_file_name' is of the form <origin_identifier>/<db_name>#<suffix>. // <suffix> is optional. DCHECK(!vfs_file_name.empty()); @@ -26,8 +26,8 @@ bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, size_t last_pound_index = vfs_file_name.rfind('#'); // '/' and '#' must be present in the string. Also, the string cannot start // with a '/' (origin_identifier cannot be empty) and '/' must come before '#' - if ((first_slash_index == string16::npos) || - (last_pound_index == string16::npos) || + if ((first_slash_index == base::string16::npos) || + (last_pound_index == base::string16::npos) || (first_slash_index == 0) || (first_slash_index > last_pound_index)) { return false; @@ -47,10 +47,10 @@ bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, } base::FilePath DatabaseUtil::GetFullFilePathForVfsFile( - DatabaseTracker* db_tracker, const string16& vfs_file_name) { - string16 origin_identifier; - string16 database_name; - string16 sqlite_suffix; + DatabaseTracker* db_tracker, const base::string16& vfs_file_name) { + base::string16 origin_identifier; + base::string16 database_name; + base::string16 sqlite_suffix; if (!CrackVfsFileName(vfs_file_name, &origin_identifier, &database_name, &sqlite_suffix)) { return base::FilePath(); // invalid vfs_file_name @@ -70,12 +70,13 @@ base::FilePath DatabaseUtil::GetFullFilePathForVfsFile( return full_path; } -string16 DatabaseUtil::GetOriginIdentifier(const GURL& url) { - string16 spec = UTF8ToUTF16(url.spec()); +base::string16 DatabaseUtil::GetOriginIdentifier(const GURL& url) { + base::string16 spec = UTF8ToUTF16(url.spec()); return WebKit::WebSecurityOrigin::createFromString(spec).databaseIdentifier(); } -GURL DatabaseUtil::GetOriginFromIdentifier(const string16& origin_identifier) { +GURL DatabaseUtil::GetOriginFromIdentifier( + const base::string16& origin_identifier) { WebKit::WebSecurityOrigin web_security_origin = WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( origin_identifier); @@ -91,15 +92,16 @@ GURL DatabaseUtil::GetOriginFromIdentifier(const string16& origin_identifier) { return GURL(web_security_origin.toString()); } -bool DatabaseUtil::IsValidOriginIdentifier(const string16& origin_identifier) { - string16 dotdot = ASCIIToUTF16(".."); +bool DatabaseUtil::IsValidOriginIdentifier( + const base::string16& origin_identifier) { + base::string16 dotdot = ASCIIToUTF16(".."); char16 forbidden[] = {'\\', '/', '\0'}; - string16::size_type pos = origin_identifier.find(dotdot); - if (pos == string16::npos) + base::string16::size_type pos = origin_identifier.find(dotdot); + if (pos == base::string16::npos) pos = origin_identifier.find_first_of(forbidden, 0, arraysize(forbidden)); - return pos == string16::npos; + return pos == base::string16::npos; } } // namespace webkit_database diff --git a/webkit/database/database_util.h b/webkit/database/database_util.h index 8b366aab..6cacb14 100644 --- a/webkit/database/database_util.h +++ b/webkit/database/database_util.h @@ -23,15 +23,16 @@ class WEBKIT_STORAGE_EXPORT DatabaseUtil { // Extract various information from a database vfs_file_name. All return // parameters are optional. - static bool CrackVfsFileName(const string16& vfs_file_name, - string16* origin_identifier, - string16* database_name, - string16* sqlite_suffix); - static base::FilePath GetFullFilePathForVfsFile(DatabaseTracker* db_tracker, - const string16& vfs_file_name); - static string16 GetOriginIdentifier(const GURL& url); - static GURL GetOriginFromIdentifier(const string16& origin_identifier); - static bool IsValidOriginIdentifier(const string16& origin_identifier); + static bool CrackVfsFileName(const base::string16& vfs_file_name, + base::string16* origin_identifier, + base::string16* database_name, + base::string16* sqlite_suffix); + static base::FilePath GetFullFilePathForVfsFile( + DatabaseTracker* db_tracker, + const base::string16& vfs_file_name); + static base::string16 GetOriginIdentifier(const GURL& url); + static GURL GetOriginFromIdentifier(const base::string16& origin_identifier); + static bool IsValidOriginIdentifier(const base::string16& origin_identifier); }; } // namespace webkit_database diff --git a/webkit/database/database_util_unittest.cc b/webkit/database/database_util_unittest.cc index aa9d007..bbbfcd6b 100644 --- a/webkit/database/database_util_unittest.cc +++ b/webkit/database/database_util_unittest.cc @@ -14,9 +14,9 @@ static void TestVfsFilePath(bool expected_result, const char* expected_origin_identifier = "", const char* expected_database_name = "", const char* expected_sqlite_suffix = "") { - string16 origin_identifier; - string16 database_name; - string16 sqlite_suffix; + base::string16 origin_identifier; + base::string16 database_name; + base::string16 sqlite_suffix; EXPECT_EQ(expected_result, DatabaseUtil::CrackVfsFileName(ASCIIToUTF16(vfs_file_name), &origin_identifier, @@ -28,7 +28,7 @@ static void TestVfsFilePath(bool expected_result, } static GURL ToAndFromOriginIdentifier(const GURL origin_url) { - string16 id = DatabaseUtil::GetOriginIdentifier(origin_url); + base::string16 id = DatabaseUtil::GetOriginIdentifier(origin_url); return DatabaseUtil::GetOriginFromIdentifier(id); } diff --git a/webkit/database/databases_table.cc b/webkit/database/databases_table.cc index ed4b6ee..fa0c837 100644 --- a/webkit/database/databases_table.cc +++ b/webkit/database/databases_table.cc @@ -37,8 +37,8 @@ bool DatabasesTable::Init() { "CREATE UNIQUE INDEX unique_index ON Databases (origin, name)")); } -int64 DatabasesTable::GetDatabaseID(const string16& origin_identifier, - const string16& database_name) { +int64 DatabasesTable::GetDatabaseID(const base::string16& origin_identifier, + const base::string16& database_name) { sql::Statement select_statement(db_->GetCachedStatement( SQL_FROM_HERE, "SELECT id FROM Databases WHERE origin = ? AND name = ?")); select_statement.BindString16(0, origin_identifier); @@ -51,8 +51,8 @@ int64 DatabasesTable::GetDatabaseID(const string16& origin_identifier, return -1; } -bool DatabasesTable::GetDatabaseDetails(const string16& origin_identifier, - const string16& database_name, +bool DatabasesTable::GetDatabaseDetails(const base::string16& origin_identifier, + const base::string16& database_name, DatabaseDetails* details) { DCHECK(details); sql::Statement select_statement(db_->GetCachedStatement( @@ -96,8 +96,9 @@ bool DatabasesTable::UpdateDatabaseDetails(const DatabaseDetails& details) { return (update_statement.Run() && db_->GetLastChangeCount()); } -bool DatabasesTable::DeleteDatabaseDetails(const string16& origin_identifier, - const string16& database_name) { +bool DatabasesTable::DeleteDatabaseDetails( + const base::string16& origin_identifier, + const base::string16& database_name) { sql::Statement delete_statement(db_->GetCachedStatement( SQL_FROM_HERE, "DELETE FROM Databases WHERE origin = ? AND name = ?")); delete_statement.BindString16(0, origin_identifier); @@ -106,7 +107,7 @@ bool DatabasesTable::DeleteDatabaseDetails(const string16& origin_identifier, return (delete_statement.Run() && db_->GetLastChangeCount()); } -bool DatabasesTable::GetAllOrigins(std::vector<string16>* origins) { +bool DatabasesTable::GetAllOrigins(std::vector<base::string16>* origins) { sql::Statement statement(db_->GetCachedStatement( SQL_FROM_HERE, "SELECT DISTINCT origin FROM Databases ORDER BY origin")); @@ -117,7 +118,7 @@ bool DatabasesTable::GetAllOrigins(std::vector<string16>* origins) { } bool DatabasesTable::GetAllDatabaseDetailsForOrigin( - const string16& origin_identifier, + const base::string16& origin_identifier, std::vector<DatabaseDetails>* details_vector) { sql::Statement statement(db_->GetCachedStatement( SQL_FROM_HERE, "SELECT name, description, estimated_size " @@ -136,7 +137,7 @@ bool DatabasesTable::GetAllDatabaseDetailsForOrigin( return statement.Succeeded(); } -bool DatabasesTable::DeleteOrigin(const string16& origin_identifier) { +bool DatabasesTable::DeleteOrigin(const base::string16& origin_identifier) { sql::Statement delete_statement(db_->GetCachedStatement( SQL_FROM_HERE, "DELETE FROM Databases WHERE origin = ?")); delete_statement.BindString16(0, origin_identifier); diff --git a/webkit/database/databases_table.h b/webkit/database/databases_table.h index d7a2581..91abad9 100644 --- a/webkit/database/databases_table.h +++ b/webkit/database/databases_table.h @@ -20,9 +20,9 @@ struct WEBKIT_STORAGE_EXPORT_PRIVATE DatabaseDetails { DatabaseDetails(); ~DatabaseDetails(); - string16 origin_identifier; - string16 database_name; - string16 description; + base::string16 origin_identifier; + base::string16 database_name; + base::string16 description; int64 estimated_size; }; @@ -31,19 +31,19 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE DatabasesTable { explicit DatabasesTable(sql::Connection* db) : db_(db) { } bool Init(); - int64 GetDatabaseID(const string16& origin_identifier, - const string16& database_name); - bool GetDatabaseDetails(const string16& origin_identifier, - const string16& database_name, + int64 GetDatabaseID(const base::string16& origin_identifier, + const base::string16& database_name); + bool GetDatabaseDetails(const base::string16& origin_identifier, + const base::string16& database_name, DatabaseDetails* details); bool InsertDatabaseDetails(const DatabaseDetails& details); bool UpdateDatabaseDetails(const DatabaseDetails& details); - bool DeleteDatabaseDetails(const string16& origin_identifier, - const string16& database_name); - bool GetAllOrigins(std::vector<string16>* origins); - bool GetAllDatabaseDetailsForOrigin(const string16& origin_identifier, + bool DeleteDatabaseDetails(const base::string16& origin_identifier, + const base::string16& database_name); + bool GetAllOrigins(std::vector<base::string16>* origins); + bool GetAllDatabaseDetailsForOrigin(const base::string16& origin_identifier, std::vector<DatabaseDetails>* details); - bool DeleteOrigin(const string16& origin_identifier); + bool DeleteOrigin(const base::string16& origin_identifier); private: sql::Connection* db_; }; diff --git a/webkit/database/databases_table_unittest.cc b/webkit/database/databases_table_unittest.cc index 1849c6a..c7f58bd6 100644 --- a/webkit/database/databases_table_unittest.cc +++ b/webkit/database/databases_table_unittest.cc @@ -124,7 +124,7 @@ TEST(DatabasesTableTest, TestIt) { CheckDetailsAreEqual(details_in2, details_out_origin1[1]); // Get the list of all origins: should be "origin1" and "origin2". - std::vector<string16> origins_out; + std::vector<base::string16> origins_out; EXPECT_TRUE(databases_table.GetAllOrigins(&origins_out)); EXPECT_EQ(size_t(2), origins_out.size()); EXPECT_EQ(details_in1.origin_identifier, origins_out[0]); diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc index 3700238..08bb6bf 100644 --- a/webkit/dom_storage/dom_storage_area.cc +++ b/webkit/dom_storage/dom_storage_area.cc @@ -118,15 +118,15 @@ NullableString16 DomStorageArea::Key(unsigned index) { return map_->Key(index); } -NullableString16 DomStorageArea::GetItem(const string16& key) { +NullableString16 DomStorageArea::GetItem(const base::string16& key) { if (is_shutdown_) return NullableString16(true); InitialImportIfNeeded(); return map_->GetItem(key); } -bool DomStorageArea::SetItem(const string16& key, - const string16& value, +bool DomStorageArea::SetItem(const base::string16& key, + const base::string16& value, NullableString16* old_value) { if (is_shutdown_) return false; @@ -141,7 +141,8 @@ bool DomStorageArea::SetItem(const string16& key, return success; } -bool DomStorageArea::RemoveItem(const string16& key, string16* old_value) { +bool DomStorageArea::RemoveItem(const base::string16& key, + base::string16* old_value) { if (is_shutdown_) return false; InitialImportIfNeeded(); diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h index d804b41..0c0a76b 100644 --- a/webkit/dom_storage/dom_storage_area.h +++ b/webkit/dom_storage/dom_storage_area.h @@ -53,10 +53,10 @@ class WEBKIT_STORAGE_EXPORT DomStorageArea unsigned Length(); NullableString16 Key(unsigned index); - NullableString16 GetItem(const string16& key); - bool SetItem(const string16& key, const string16& value, + NullableString16 GetItem(const base::string16& key); + bool SetItem(const base::string16& key, const base::string16& value, NullableString16* old_value); - bool RemoveItem(const string16& key, string16* old_value); + bool RemoveItem(const base::string16& key, base::string16* old_value); bool Clear(); void FastClear(); diff --git a/webkit/dom_storage/dom_storage_area_unittest.cc b/webkit/dom_storage/dom_storage_area_unittest.cc index 6667312..6a051bc 100644 --- a/webkit/dom_storage/dom_storage_area_unittest.cc +++ b/webkit/dom_storage/dom_storage_area_unittest.cc @@ -32,10 +32,10 @@ class DomStorageAreaTest : public testing::Test { } const GURL kOrigin; - const string16 kKey; - const string16 kValue; - const string16 kKey2; - const string16 kValue2; + const base::string16 kKey; + const base::string16 kValue; + const base::string16 kKey2; + const base::string16 kValue2; // Method used in the CommitTasks test case. void InjectedCommitSequencingTask(DomStorageArea* area) { @@ -58,8 +58,8 @@ class DomStorageAreaTest : public testing::Test { public: VerifyChangesCommittedDatabase() {} virtual ~VerifyChangesCommittedDatabase() { - const string16 kKey(ASCIIToUTF16("key")); - const string16 kValue(ASCIIToUTF16("value")); + const base::string16 kKey(ASCIIToUTF16("key")); + const base::string16 kValue(ASCIIToUTF16("value")); ValuesMap values; ReadAllValues(&values); EXPECT_EQ(1u, values.size()); @@ -74,7 +74,7 @@ class DomStorageAreaTest : public testing::Test { TEST_F(DomStorageAreaTest, DomStorageAreaBasics) { scoped_refptr<DomStorageArea> area( new DomStorageArea(1, std::string(), kOrigin, NULL, NULL)); - string16 old_value; + base::string16 old_value; NullableString16 old_nullable_value; scoped_refptr<DomStorageArea> copy; diff --git a/webkit/dom_storage/dom_storage_cached_area.cc b/webkit/dom_storage/dom_storage_cached_area.cc index 30d6291..af5e1f4 100644 --- a/webkit/dom_storage/dom_storage_cached_area.cc +++ b/webkit/dom_storage/dom_storage_cached_area.cc @@ -34,14 +34,14 @@ NullableString16 DomStorageCachedArea::GetKey( } NullableString16 DomStorageCachedArea::GetItem( - int connection_id, const string16& key) { + int connection_id, const base::string16& key) { PrimeIfNeeded(connection_id); return map_->GetItem(key); } bool DomStorageCachedArea::SetItem( - int connection_id, const string16& key, - const string16& value, const GURL& page_url) { + int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url) { // A quick check to reject obviously overbudget items to avoid // the priming the cache. if (key.length() + value.length() > dom_storage::kPerAreaQuota) @@ -62,9 +62,9 @@ bool DomStorageCachedArea::SetItem( } void DomStorageCachedArea::RemoveItem( - int connection_id, const string16& key, const GURL& page_url) { + int connection_id, const base::string16& key, const GURL& page_url) { PrimeIfNeeded(connection_id); - string16 unused; + base::string16 unused; if (!map_->RemoveItem(key, &unused)) return; @@ -101,7 +101,8 @@ void DomStorageCachedArea::ApplyMutation( // We have to retain local additions which happened after this // clear operation from another process. - std::map<string16, int>::iterator iter = ignore_key_mutations_.begin(); + std::map<base::string16, int>::iterator iter = + ignore_key_mutations_.begin(); while (iter != ignore_key_mutations_.end()) { NullableString16 value = old->GetItem(iter->first); if (!value.is_null()) { @@ -119,7 +120,7 @@ void DomStorageCachedArea::ApplyMutation( if (new_value.is_null()) { // It's a remove item event. - string16 unused; + base::string16 unused; map_->RemoveItem(key.string(), &unused); return; } @@ -198,21 +199,23 @@ void DomStorageCachedArea::OnLoadComplete(bool success) { } void DomStorageCachedArea::OnSetItemComplete( - const string16& key, bool success) { + const base::string16& key, bool success) { if (!success) { Reset(); return; } - std::map<string16, int>::iterator found = ignore_key_mutations_.find(key); + std::map<base::string16, int>::iterator found = + ignore_key_mutations_.find(key); DCHECK(found != ignore_key_mutations_.end()); if (--found->second == 0) ignore_key_mutations_.erase(found); } void DomStorageCachedArea::OnRemoveItemComplete( - const string16& key, bool success) { + const base::string16& key, bool success) { DCHECK(success); - std::map<string16, int>::iterator found = ignore_key_mutations_.find(key); + std::map<base::string16, int>::iterator found = + ignore_key_mutations_.find(key); DCHECK(found != ignore_key_mutations_.end()); if (--found->second == 0) ignore_key_mutations_.erase(found); diff --git a/webkit/dom_storage/dom_storage_cached_area.h b/webkit/dom_storage/dom_storage_cached_area.h index ae45a9c..81e8467 100644 --- a/webkit/dom_storage/dom_storage_cached_area.h +++ b/webkit/dom_storage/dom_storage_cached_area.h @@ -35,10 +35,12 @@ class WEBKIT_STORAGE_EXPORT DomStorageCachedArea : unsigned GetLength(int connection_id); NullableString16 GetKey(int connection_id, unsigned index); - NullableString16 GetItem(int connection_id, const string16& key); - bool SetItem(int connection_id, const string16& key, const string16& value, + NullableString16 GetItem(int connection_id, const base::string16& key); + bool SetItem(int connection_id, + const base::string16& key, + const base::string16& value, const GURL& page_url); - void RemoveItem(int connection_id, const string16& key, + void RemoveItem(int connection_id, const base::string16& key, const GURL& page_url); void Clear(int connection_id, const GURL& page_url); @@ -67,16 +69,16 @@ class WEBKIT_STORAGE_EXPORT DomStorageCachedArea : // mutation events from other processes from overwriting local // changes made after the mutation. void OnLoadComplete(bool success); - void OnSetItemComplete(const string16& key, bool success); + void OnSetItemComplete(const base::string16& key, bool success); void OnClearComplete(bool success); - void OnRemoveItemComplete(const string16& key, bool success); + void OnRemoveItemComplete(const base::string16& key, bool success); - bool should_ignore_key_mutation(const string16& key) const { + bool should_ignore_key_mutation(const base::string16& key) const { return ignore_key_mutations_.find(key) != ignore_key_mutations_.end(); } bool ignore_all_mutations_; - std::map<string16, int> ignore_key_mutations_; + std::map<base::string16, int> ignore_key_mutations_; int64 namespace_id_; GURL origin_; diff --git a/webkit/dom_storage/dom_storage_cached_area_unittest.cc b/webkit/dom_storage/dom_storage_cached_area_unittest.cc index 61b3cfe..d55d73f 100644 --- a/webkit/dom_storage/dom_storage_cached_area_unittest.cc +++ b/webkit/dom_storage/dom_storage_cached_area_unittest.cc @@ -30,8 +30,8 @@ class MockProxy : public DomStorageProxy { *values = load_area_return_values_; } - virtual void SetItem(int connection_id, const string16& key, - const string16& value, const GURL& page_url, + virtual void SetItem(int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, const CompletionCallback& callback) OVERRIDE { pending_callbacks_.push_back(callback); observed_set_item_ = true; @@ -41,7 +41,7 @@ class MockProxy : public DomStorageProxy { observed_page_url_ = page_url; } - virtual void RemoveItem(int connection_id, const string16& key, + virtual void RemoveItem(int connection_id, const base::string16& key, const GURL& page_url, const CompletionCallback& callback) OVERRIDE { pending_callbacks_.push_back(callback); @@ -93,8 +93,8 @@ class MockProxy : public DomStorageProxy { bool observed_remove_item_; bool observed_clear_area_; int observed_connection_id_; - string16 observed_key_; - string16 observed_value_; + base::string16 observed_key_; + base::string16 observed_value_; GURL observed_page_url_; private: @@ -114,8 +114,8 @@ class DomStorageCachedAreaTest : public testing::Test { const int64 kNamespaceId; const GURL kOrigin; - const string16 kKey; - const string16 kValue; + const base::string16 kKey; + const base::string16 kValue; const GURL kPageUrl; virtual void SetUp() { @@ -131,7 +131,7 @@ class DomStorageCachedAreaTest : public testing::Test { } bool IsIgnoringKeyMutations(DomStorageCachedArea* cached_area, - const string16& key) { + const base::string16& key) { return cached_area->should_ignore_key_mutation(key); } diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc index 45aae74..8065ec6 100644 --- a/webkit/dom_storage/dom_storage_context.cc +++ b/webkit/dom_storage/dom_storage_context.cc @@ -210,8 +210,8 @@ void DomStorageContext::RemoveEventObserver(EventObserver* observer) { void DomStorageContext::NotifyItemSet( const DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, const GURL& page_url) { FOR_EACH_OBSERVER( @@ -221,8 +221,8 @@ void DomStorageContext::NotifyItemSet( void DomStorageContext::NotifyItemRemoved( const DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url) { FOR_EACH_OBSERVER( EventObserver, event_observers_, diff --git a/webkit/dom_storage/dom_storage_context.h b/webkit/dom_storage/dom_storage_context.h index 20ae0ed..33ae2c5 100644 --- a/webkit/dom_storage/dom_storage_context.h +++ b/webkit/dom_storage/dom_storage_context.h @@ -68,14 +68,14 @@ class WEBKIT_STORAGE_EXPORT DomStorageContext public: virtual void OnDomStorageItemSet( const DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, // may be null on initial insert const GURL& page_url) = 0; virtual void OnDomStorageItemRemoved( const DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url) = 0; virtual void OnDomStorageAreaCleared( const DomStorageArea* area, @@ -131,14 +131,14 @@ class WEBKIT_STORAGE_EXPORT DomStorageContext void RemoveEventObserver(EventObserver* observer); void NotifyItemSet( const DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, const GURL& page_url); void NotifyItemRemoved( const DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url); void NotifyAreaCleared( const DomStorageArea* area, diff --git a/webkit/dom_storage/dom_storage_context_unittest.cc b/webkit/dom_storage/dom_storage_context_unittest.cc index f2bebc1..ec1d910 100644 --- a/webkit/dom_storage/dom_storage_context_unittest.cc +++ b/webkit/dom_storage/dom_storage_context_unittest.cc @@ -31,8 +31,8 @@ class DomStorageContextTest : public testing::Test { } const GURL kOrigin; - const string16 kKey; - const string16 kValue; + const base::string16 kKey; + const base::string16 kValue; const bool kDontIncludeFileInfo; const bool kDoIncludeFileInfo; @@ -205,8 +205,8 @@ TEST_F(DomStorageContextTest, DeleteSessionStorage) { DomStorageNamespace* dom_namespace = context_->GetStorageNamespace(kSessionStorageNamespaceId); DomStorageArea* area = dom_namespace->OpenStorageArea(kOrigin); - const string16 kKey(ASCIIToUTF16("foo")); - const string16 kValue(ASCIIToUTF16("bar")); + const base::string16 kKey(ASCIIToUTF16("foo")); + const base::string16 kValue(ASCIIToUTF16("bar")); NullableString16 old_nullable_value; area->SetItem(kKey, kValue, &old_nullable_value); dom_namespace->CloseStorageArea(area); diff --git a/webkit/dom_storage/dom_storage_database.cc b/webkit/dom_storage/dom_storage_database.cc index a49e93b..85f4218 100644 --- a/webkit/dom_storage/dom_storage_database.cc +++ b/webkit/dom_storage/dom_storage_database.cc @@ -72,8 +72,8 @@ void DomStorageDatabase::ReadAllValues(ValuesMap* result) { DCHECK(statement.is_valid()); while (statement.Step()) { - string16 key = statement.ColumnString16(0); - string16 value; + base::string16 key = statement.ColumnString16(0); + base::string16 value; statement.ColumnBlobAsString16(1, &value); (*result)[key] = NullableString16(value, false); } @@ -105,7 +105,7 @@ bool DomStorageDatabase::CommitChanges(bool clear_all_first, ValuesMap::const_iterator it = changes.begin(); for(; it != changes.end(); ++it) { sql::Statement statement; - string16 key = it->first; + base::string16 key = it->first; NullableString16 value = it->second; if (value.is_null()) { statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, @@ -284,7 +284,7 @@ bool DomStorageDatabase::UpgradeVersion1To2() { // the data into the new V2 table. ValuesMap values; while (statement.Step()) { - string16 key = statement.ColumnString16(0); + base::string16 key = statement.ColumnString16(0); NullableString16 value(statement.ColumnString16(1), false); values[key] = value; } diff --git a/webkit/dom_storage/dom_storage_database_unittest.cc b/webkit/dom_storage/dom_storage_database_unittest.cc index 7e50cc7..e39f5f7 100644 --- a/webkit/dom_storage/dom_storage_database_unittest.cc +++ b/webkit/dom_storage/dom_storage_database_unittest.cc @@ -54,8 +54,8 @@ void CreateInvalidValueColumnTable(sql::Connection* db) { } void InsertDataV1(sql::Connection* db, - const string16& key, - const string16& value) { + const base::string16& key, + const base::string16& value) { sql::Statement statement(db->GetCachedStatement(SQL_FROM_HERE, "INSERT INTO ItemTable VALUES (?,?)")); statement.BindString16(0, key); @@ -72,7 +72,7 @@ void CheckValuesMatch(DomStorageDatabase* db, ValuesMap::const_iterator it = values_read.begin(); for (; it != values_read.end(); ++it) { - string16 key = it->first; + base::string16 key = it->first; NullableString16 value = it->second; NullableString16 expected_value = expected.find(key)->second; EXPECT_EQ(expected_value.string(), value.string()); @@ -81,7 +81,7 @@ void CheckValuesMatch(DomStorageDatabase* db, } void CreateMapWithValues(ValuesMap* values) { - string16 kCannedKeys[] = { + base::string16 kCannedKeys[] = { ASCIIToUTF16("test"), ASCIIToUTF16("company"), ASCIIToUTF16("date"), @@ -91,7 +91,7 @@ void CreateMapWithValues(ValuesMap* values) { NullableString16(ASCIIToUTF16("123"), false), NullableString16(ASCIIToUTF16("Google"), false), NullableString16(ASCIIToUTF16("18-01-2012"), false), - NullableString16(string16(), false) + NullableString16(base::string16(), false) }; for (unsigned i = 0; i < sizeof(kCannedKeys) / sizeof(kCannedKeys[0]); i++) (*values)[kCannedKeys[i]] = kCannedValues[i]; @@ -259,7 +259,7 @@ TEST(DomStorageDatabaseTest, WriteWithClear) { } TEST(DomStorageDatabaseTest, UpgradeFromV1ToV2WithData) { - const string16 kCannedKey = ASCIIToUTF16("foo"); + const base::string16 kCannedKey = ASCIIToUTF16("foo"); const NullableString16 kCannedValue(ASCIIToUTF16("bar"), false); ValuesMap expected; expected[kCannedKey] = kCannedValue; @@ -281,7 +281,7 @@ TEST(DomStorageDatabaseTest, TestSimpleRemoveOneValue) { DomStorageDatabase db; ASSERT_TRUE(db.LazyOpen(true)); - const string16 kCannedKey = ASCIIToUTF16("test"); + const base::string16 kCannedKey = ASCIIToUTF16("test"); const NullableString16 kCannedValue(ASCIIToUTF16("data"), false); ValuesMap expected; expected[kCannedKey] = kCannedValue; diff --git a/webkit/dom_storage/dom_storage_host.cc b/webkit/dom_storage/dom_storage_host.cc index ca0ac80..a8637e0 100644 --- a/webkit/dom_storage/dom_storage_host.cc +++ b/webkit/dom_storage/dom_storage_host.cc @@ -80,7 +80,7 @@ NullableString16 DomStorageHost::GetAreaKey(int connection_id, unsigned index) { } NullableString16 DomStorageHost::GetAreaItem(int connection_id, - const string16& key) { + const base::string16& key) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) return NullableString16(true); @@ -88,8 +88,8 @@ NullableString16 DomStorageHost::GetAreaItem(int connection_id, } bool DomStorageHost::SetAreaItem( - int connection_id, const string16& key, - const string16& value, const GURL& page_url, + int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, NullableString16* old_value) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) { @@ -106,8 +106,8 @@ bool DomStorageHost::SetAreaItem( } bool DomStorageHost::RemoveAreaItem( - int connection_id, const string16& key, const GURL& page_url, - string16* old_value) { + int connection_id, const base::string16& key, const GURL& page_url, + base::string16* old_value) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) return false; diff --git a/webkit/dom_storage/dom_storage_host.h b/webkit/dom_storage/dom_storage_host.h index 54a18a4..ccdfab3 100644 --- a/webkit/dom_storage/dom_storage_host.h +++ b/webkit/dom_storage/dom_storage_host.h @@ -38,13 +38,13 @@ class WEBKIT_STORAGE_EXPORT DomStorageHost { bool ExtractAreaValues(int connection_id, ValuesMap* map); unsigned GetAreaLength(int connection_id); NullableString16 GetAreaKey(int connection_id, unsigned index); - NullableString16 GetAreaItem(int connection_id, const string16& key); - bool SetAreaItem(int connection_id, const string16& key, - const string16& value, const GURL& page_url, + NullableString16 GetAreaItem(int connection_id, const base::string16& key); + bool SetAreaItem(int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, NullableString16* old_value); - bool RemoveAreaItem(int connection_id, const string16& key, + bool RemoveAreaItem(int connection_id, const base::string16& key, const GURL& page_url, - string16* old_value); + base::string16* old_value); bool ClearArea(int connection_id, const GURL& page_url); bool HasAreaOpen(int namespace_id, const GURL& origin) const; diff --git a/webkit/dom_storage/dom_storage_map.cc b/webkit/dom_storage/dom_storage_map.cc index 6c086b6..fa8eb09 100644 --- a/webkit/dom_storage/dom_storage_map.cc +++ b/webkit/dom_storage/dom_storage_map.cc @@ -8,7 +8,7 @@ namespace { -size_t size_of_item(const string16& key, const string16& value) { +size_t size_of_item(const base::string16& key, const base::string16& value) { return (key.length() + value.length()) * sizeof(char16); } @@ -54,7 +54,7 @@ NullableString16 DomStorageMap::Key(unsigned index) { return NullableString16(key_iterator_->first, false); } -NullableString16 DomStorageMap::GetItem(const string16& key) const { +NullableString16 DomStorageMap::GetItem(const base::string16& key) const { ValuesMap::const_iterator found = values_.find(key); if (found == values_.end()) return NullableString16(true); @@ -62,7 +62,7 @@ NullableString16 DomStorageMap::GetItem(const string16& key) const { } bool DomStorageMap::SetItem( - const string16& key, const string16& value, + const base::string16& key, const base::string16& value, NullableString16* old_value) { ValuesMap::const_iterator found = values_.find(key); if (found == values_.end()) @@ -87,8 +87,8 @@ bool DomStorageMap::SetItem( } bool DomStorageMap::RemoveItem( - const string16& key, - string16* old_value) { + const base::string16& key, + base::string16* old_value) { ValuesMap::iterator found = values_.find(key); if (found == values_.end()) return false; diff --git a/webkit/dom_storage/dom_storage_map.h b/webkit/dom_storage/dom_storage_map.h index 3a1d6f8..97d704e 100644 --- a/webkit/dom_storage/dom_storage_map.h +++ b/webkit/dom_storage/dom_storage_map.h @@ -25,10 +25,10 @@ class WEBKIT_STORAGE_EXPORT DomStorageMap unsigned Length() const; NullableString16 Key(unsigned index); - NullableString16 GetItem(const string16& key) const; - bool SetItem(const string16& key, const string16& value, + NullableString16 GetItem(const base::string16& key) const; + bool SetItem(const base::string16& key, const base::string16& value, NullableString16* old_value); - bool RemoveItem(const string16& key, string16* old_value); + bool RemoveItem(const base::string16& key, base::string16* old_value); // Swaps this instances values_ with |map|. // Note: to grandfather in pre-existing files that are overbudget, diff --git a/webkit/dom_storage/dom_storage_map_unittest.cc b/webkit/dom_storage/dom_storage_map_unittest.cc index 89edbc3..8339a54 100644 --- a/webkit/dom_storage/dom_storage_map_unittest.cc +++ b/webkit/dom_storage/dom_storage_map_unittest.cc @@ -9,20 +9,20 @@ namespace dom_storage { TEST(DomStorageMapTest, DomStorageMapBasics) { - const string16 kKey(ASCIIToUTF16("key")); - const string16 kValue(ASCIIToUTF16("value")); + const base::string16 kKey(ASCIIToUTF16("key")); + const base::string16 kValue(ASCIIToUTF16("value")); const size_t kValueBytes = kValue.size() * sizeof(char16); const size_t kItemBytes = (kKey.size() + kValue.size()) * sizeof(char16); - const string16 kKey2(ASCIIToUTF16("key2")); + const base::string16 kKey2(ASCIIToUTF16("key2")); const size_t kKey2Bytes = kKey2.size() * sizeof(char16); - const string16 kValue2(ASCIIToUTF16("value2")); + const base::string16 kValue2(ASCIIToUTF16("value2")); const size_t kItem2Bytes = (kKey2.size() + kValue2.size()) * sizeof(char16); const size_t kQuota = 1024; // 1K quota for this test. scoped_refptr<DomStorageMap> map(new DomStorageMap(kQuota)); - string16 old_value; + base::string16 old_value; NullableString16 old_nullable_value; ValuesMap swap; scoped_refptr<DomStorageMap> copy; @@ -83,15 +83,15 @@ TEST(DomStorageMapTest, DomStorageMapBasics) { } TEST(DomStorageMapTest, EnforcesQuota) { - const string16 kKey = ASCIIToUTF16("test_key"); - const string16 kValue = ASCIIToUTF16("test_value"); - const string16 kKey2 = ASCIIToUTF16("test_key_2"); + const base::string16 kKey = ASCIIToUTF16("test_key"); + const base::string16 kValue = ASCIIToUTF16("test_value"); + const base::string16 kKey2 = ASCIIToUTF16("test_key_2"); // A 50 byte quota is too small to hold both keys, so we // should see the DomStorageMap enforcing it. const size_t kQuota = 50; - string16 old_value; + base::string16 old_value; NullableString16 old_nullable_value; scoped_refptr<DomStorageMap> map(new DomStorageMap(kQuota)); @@ -115,9 +115,9 @@ TEST(DomStorageMapTest, EnforcesQuota) { // When overbudget, a new value of greater size than the existing value can // not be set, but a new value of lesser or equal size can be set. EXPECT_TRUE(map->SetItem(kKey, kValue, &old_nullable_value)); - EXPECT_FALSE(map->SetItem(kKey, string16(kValue + kValue), + EXPECT_FALSE(map->SetItem(kKey, base::string16(kValue + kValue), &old_nullable_value)); - EXPECT_TRUE(map->SetItem(kKey, string16(), &old_nullable_value)); + EXPECT_TRUE(map->SetItem(kKey, base::string16(), &old_nullable_value)); EXPECT_EQ(kValue, old_nullable_value.string()); } diff --git a/webkit/dom_storage/dom_storage_proxy.h b/webkit/dom_storage/dom_storage_proxy.h index 867d3bb..9091ca2 100644 --- a/webkit/dom_storage/dom_storage_proxy.h +++ b/webkit/dom_storage/dom_storage_proxy.h @@ -22,11 +22,11 @@ class DomStorageProxy : public base::RefCounted<DomStorageProxy> { virtual void LoadArea(int connection_id, ValuesMap* values, const CompletionCallback& callback) = 0; - virtual void SetItem(int connection_id, const string16& key, - const string16& value, const GURL& page_url, + virtual void SetItem(int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, const CompletionCallback& callback) = 0; - virtual void RemoveItem(int connection_id, const string16& key, + virtual void RemoveItem(int connection_id, const base::string16& key, const GURL& page_url, const CompletionCallback& callback) = 0; diff --git a/webkit/dom_storage/dom_storage_types.h b/webkit/dom_storage/dom_storage_types.h index 180fb80..1f663b4 100644 --- a/webkit/dom_storage/dom_storage_types.h +++ b/webkit/dom_storage/dom_storage_types.h @@ -35,7 +35,7 @@ const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId; // Value to indicate an area that not be opened. const int kInvalidAreaId = -1; -typedef std::map<string16, NullableString16> ValuesMap; +typedef std::map<base::string16, NullableString16> ValuesMap; struct WEBKIT_STORAGE_EXPORT LocalStorageUsageInfo { GURL origin; diff --git a/webkit/dom_storage/session_storage_database.cc b/webkit/dom_storage/session_storage_database.cc index 2e873d7..699221f 100644 --- a/webkit/dom_storage/session_storage_database.cc +++ b/webkit/dom_storage/session_storage_database.cc @@ -521,16 +521,16 @@ bool SessionStorageDatabase::ReadMap(const std::string& map_id, break; } // Key is of the form "map-<mapid>-<key>". - string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length())); + base::string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length())); if (only_keys) { (*result)[key16] = NullableString16(true); } else { // Convert the raw data stored in std::string (it->value()) to raw data - // stored in string16. + // stored in base::string16. size_t len = it->value().size() / sizeof(char16); const char16* data_ptr = reinterpret_cast<const char16*>(it->value().data()); - (*result)[key16] = NullableString16(string16(data_ptr, len), false); + (*result)[key16] = NullableString16(base::string16(data_ptr, len), false); } } return true; @@ -546,7 +546,7 @@ void SessionStorageDatabase::WriteValuesToMap(const std::string& map_id, if (value.is_null()) { batch->Delete(key); } else { - // Convert the raw data stored in string16 to raw data stored in + // Convert the raw data stored in base::string16 to raw data stored in // std::string. const char* data = reinterpret_cast<const char*>(value.string().data()); size_t size = value.string().size() * 2; diff --git a/webkit/dom_storage/session_storage_database_unittest.cc b/webkit/dom_storage/session_storage_database_unittest.cc index d570f3f6..414d7d4 100644 --- a/webkit/dom_storage/session_storage_database_unittest.cc +++ b/webkit/dom_storage/session_storage_database_unittest.cc @@ -68,9 +68,9 @@ class SessionStorageDatabaseTest : public testing::Test { const std::string kNamespace1; const std::string kNamespace2; const std::string kNamespaceClone; - const string16 kKey1; - const string16 kKey2; - const string16 kKey3; + const base::string16 kKey1; + const base::string16 kKey2; + const base::string16 kKey3; const NullableString16 kValue1; const NullableString16 kValue2; const NullableString16 kValue3; @@ -302,8 +302,8 @@ void SessionStorageDatabaseTest::DumpData() const { for (it->SeekToFirst(); it->Valid(); it->Next()) { int64 dummy_map_id; if (IsMapValueKey(it->key().ToString(), &dummy_map_id)) { - // Convert the value back to string16. - string16 value; + // Convert the value back to base::string16. + base::string16 value; size_t len = it->value().size() / sizeof(char16); value.resize(len); value.assign(reinterpret_cast<const char16*>(it->value().data()), len); @@ -328,7 +328,7 @@ void SessionStorageDatabaseTest::CompareValuesMaps( const ValuesMap& map2) const { ASSERT_EQ(map2.size(), map1.size()); for (ValuesMap::const_iterator it = map1.begin(); it != map1.end(); ++it) { - string16 key = it->first; + base::string16 key = it->first; ASSERT_TRUE(map2.find(key) != map2.end()); NullableString16 val1 = it->second; NullableString16 val2 = map2.find(key)->second; @@ -698,7 +698,7 @@ TEST_F(SessionStorageDatabaseTest, WriteRawBytes) { // Write data which is not valid utf8 and contains null bytes. unsigned char raw_data[10] = {255, 0, 0, 0, 1, 2, 3, 4, 5, 0}; ValuesMap changes; - string16 string_with_raw_data; + base::string16 string_with_raw_data; string_with_raw_data.assign(reinterpret_cast<char16*>(raw_data), 5); changes[kKey1] = NullableString16(string_with_raw_data, false); EXPECT_TRUE(db_->CommitAreaChanges(kNamespace1, kOrigin1, false, changes)); diff --git a/webkit/fileapi/file_system_dir_url_request_job.cc b/webkit/fileapi/file_system_dir_url_request_job.cc index 5943bcd..f3bfcfc 100644 --- a/webkit/fileapi/file_system_dir_url_request_job.cc +++ b/webkit/fileapi/file_system_dir_url_request_job.cc @@ -112,13 +112,13 @@ void FileSystemDirURLRequestJob::DidReadDirectory( #if defined(OS_POSIX) relative_path = base::FilePath(FILE_PATH_LITERAL("/") + relative_path.value()); #endif - const string16& title = relative_path.LossyDisplayName(); + const base::string16& title = relative_path.LossyDisplayName(); data_.append(net::GetDirectoryListingHeader(title)); } typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator; for (EntryIterator it = entries.begin(); it != entries.end(); ++it) { - const string16& name = base::FilePath(it->name).LossyDisplayName(); + const base::string16& name = base::FilePath(it->name).LossyDisplayName(); data_.append(net::GetDirectoryListingEntry( name, std::string(), it->is_directory, it->size, it->last_modified_time)); diff --git a/webkit/glue/clipboard_client.h b/webkit/glue/clipboard_client.h index 5126e9f..b612b7c 100644 --- a/webkit/glue/clipboard_client.h +++ b/webkit/glue/clipboard_client.h @@ -44,18 +44,19 @@ class ClipboardClient { // Reads the available types from the clipboard, if available. virtual void ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) = 0; // Reads UNICODE text from the clipboard, if available. - virtual void ReadText(ui::Clipboard::Buffer buffer, string16* result) = 0; + virtual void ReadText(ui::Clipboard::Buffer buffer, + base::string16* result) = 0; // Reads ASCII text from the clipboard, if available. virtual void ReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result) = 0; // Reads HTML from the clipboard, if available. - virtual void ReadHTML(ui::Clipboard::Buffer buffer, string16* markup, + virtual void ReadHTML(ui::Clipboard::Buffer buffer, base::string16* markup, GURL* url, uint32* fragment_start, uint32* fragment_end) = 0; @@ -67,8 +68,8 @@ class ClipboardClient { // Reads a custom data type from the clipboard, if available. virtual void ReadCustomData(ui::Clipboard::Buffer buffer, - const string16& type, - string16* data) = 0; + const base::string16& type, + base::string16* data) = 0; // Reads raw data from the clipboard for a given format. virtual void ReadData(const ui::Clipboard::FormatType& format, diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index c50d0b7..b6774ff 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -253,8 +253,8 @@ bool ElementDoesAutoCompleteForElementWithId(WebView* view, } void GetMetaElementsWithAttribute(WebDocument* document, - const string16& attribute_name, - const string16& attribute_value, + const base::string16& attribute_name, + const base::string16& attribute_value, std::vector<WebElement>* meta_elements) { DCHECK(document); DCHECK(meta_elements); diff --git a/webkit/glue/dom_operations.h b/webkit/glue/dom_operations.h index c2c4990..5ca6d94 100644 --- a/webkit/glue/dom_operations.h +++ b/webkit/glue/dom_operations.h @@ -78,8 +78,8 @@ WEBKIT_GLUE_EXPORT WebKit::WebString GetSubResourceLinkFromElement( // with a value of |attribute_value| in |meta_elements|. WEBKIT_GLUE_EXPORT void GetMetaElementsWithAttribute( WebKit::WebDocument* document, - const string16& attribute_name, - const string16& atribute_value, + const base::string16& attribute_name, + const base::string16& atribute_value, std::vector<WebKit::WebElement>* meta_elements); } // namespace webkit_glue diff --git a/webkit/glue/ftp_directory_listing_response_delegate.cc b/webkit/glue/ftp_directory_listing_response_delegate.cc index 076dfc0..3543d36 100644 --- a/webkit/glue/ftp_directory_listing_response_delegate.cc +++ b/webkit/glue/ftp_directory_listing_response_delegate.cc @@ -29,7 +29,7 @@ using WebKit::WebURLResponse; namespace { -string16 ConvertPathToUTF16(const std::string& path) { +base::string16 ConvertPathToUTF16(const std::string& path) { // Per RFC 2640, FTP servers should use UTF-8 or its proper subset ASCII, // but many old FTP servers use legacy encodings. Try UTF-8 first. if (IsStringUTF8(path)) @@ -39,7 +39,7 @@ string16 ConvertPathToUTF16(const std::string& path) { // fail. std::string encoding; if (base::DetectEncoding(path, &encoding) && !encoding.empty()) { - string16 path_utf16; + base::string16 path_utf16; if (base::CodepageToUTF16(path, encoding.c_str(), base::OnStringConversionError::SUBSTITUTE, &path_utf16)) { diff --git a/webkit/glue/glue_serialize_unittest.cc b/webkit/glue/glue_serialize_unittest.cc index b03fc53..db3941a 100644 --- a/webkit/glue/glue_serialize_unittest.cc +++ b/webkit/glue/glue_serialize_unittest.cc @@ -119,17 +119,19 @@ class GlueSerializeTest : public testing::Test { ->GetPrimaryDisplay().device_scale_factor(); } #endif - EXPECT_EQ(string16(a.urlString()), string16(b.urlString())); - EXPECT_EQ(string16(a.originalURLString()), string16(b.originalURLString())); - EXPECT_EQ(string16(a.target()), string16(b.target())); - EXPECT_EQ(string16(a.parent()), string16(b.parent())); - EXPECT_EQ(string16(a.title()), string16(b.title())); - EXPECT_EQ(string16(a.alternateTitle()), string16(b.alternateTitle())); + EXPECT_EQ(base::string16(a.urlString()), base::string16(b.urlString())); + EXPECT_EQ(base::string16(a.originalURLString()), + base::string16(b.originalURLString())); + EXPECT_EQ(base::string16(a.target()), base::string16(b.target())); + EXPECT_EQ(base::string16(a.parent()), base::string16(b.parent())); + EXPECT_EQ(base::string16(a.title()), base::string16(b.title())); + EXPECT_EQ(base::string16(a.alternateTitle()), + base::string16(b.alternateTitle())); EXPECT_EQ(a.lastVisitedTime(), b.lastVisitedTime()); EXPECT_EQ(expectedScrollOffset, b.scrollOffset()); EXPECT_EQ(a.isTargetItem(), b.isTargetItem()); EXPECT_EQ(a.visitCount(), b.visitCount()); - EXPECT_EQ(string16(a.referrer()), string16(b.referrer())); + EXPECT_EQ(base::string16(a.referrer()), base::string16(b.referrer())); if (version >= 11) EXPECT_EQ(expectedPageScaleFactor, b.pageScaleFactor()); if (version >= 9) @@ -141,7 +143,7 @@ class GlueSerializeTest : public testing::Test { const WebVector<WebString>& b_docstate = b.documentState(); EXPECT_EQ(a_docstate.size(), b_docstate.size()); for (size_t i = 0, c = a_docstate.size(); i < c; ++i) - EXPECT_EQ(string16(a_docstate[i]), string16(b_docstate[i])); + EXPECT_EQ(base::string16(a_docstate[i]), base::string16(b_docstate[i])); } void HistoryItemExpectFormDataEqual(const WebHistoryItem& a, @@ -160,11 +162,13 @@ class GlueSerializeTest : public testing::Test { EXPECT_EQ(std::string(a_elem.data.data(), a_elem.data.size()), std::string(b_elem.data.data(), b_elem.data.size())); } else { - EXPECT_EQ(string16(a_elem.filePath), string16(b_elem.filePath)); + EXPECT_EQ(base::string16(a_elem.filePath), + base::string16(b_elem.filePath)); } } } - EXPECT_EQ(string16(a.httpContentType()), string16(b.httpContentType())); + EXPECT_EQ(base::string16(a.httpContentType()), + base::string16(b.httpContentType())); } void HistoryItemExpectChildrenEqual(const WebHistoryItem& a, diff --git a/webkit/glue/web_io_operators.cc b/webkit/glue/web_io_operators.cc index 802d2e7..60e441b 100644 --- a/webkit/glue/web_io_operators.cc +++ b/webkit/glue/web_io_operators.cc @@ -20,7 +20,7 @@ namespace WebKit { #if defined(WCHAR_T_IS_UTF32) std::ostream& operator<<(std::ostream& out, const WebString& s) { - return out << static_cast<string16>(s); + return out << static_cast<base::string16>(s); } #endif // defined(WCHAR_T_IS_UTF32) diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index 6501d6f..3cbe45c 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -113,7 +113,7 @@ bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { WebVector<WebString> WebClipboardImpl::readAvailableTypes( Buffer buffer, bool* contains_filenames) { ui::Clipboard::Buffer buffer_type; - std::vector<string16> types; + std::vector<base::string16> types; if (ConvertBufferType(buffer, &buffer_type)) { client_->ReadAvailableTypes(buffer_type, &types, contains_filenames); } @@ -127,7 +127,7 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) { if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), buffer_type)) { - string16 text; + base::string16 text; client_->ReadText(buffer_type, &text); if (!text.empty()) return text; @@ -151,7 +151,7 @@ WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url, if (!ConvertBufferType(buffer, &buffer_type)) return WebString(); - string16 html_stdstr; + base::string16 html_stdstr; GURL gurl; client_->ReadHTML(buffer_type, &html_stdstr, &gurl, static_cast<uint32*>(fragment_start), @@ -176,7 +176,7 @@ WebString WebClipboardImpl::readCustomData(Buffer buffer, if (!ConvertBufferType(buffer, &buffer_type)) return WebString(); - string16 data; + base::string16 data; client_->ReadCustomData(buffer_type, type, &data); return data; } diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc index 3f20622..5cbfa8a 100644 --- a/webkit/glue/webdropdata.cc +++ b/webkit/glue/webdropdata.cc @@ -24,8 +24,8 @@ using WebKit::WebVector; WebDropData::FileInfo::FileInfo() { } -WebDropData::FileInfo::FileInfo(const string16& path, - const string16& display_name) +WebDropData::FileInfo::FileInfo(const base::string16& path, + const base::string16& display_name) : path(path), display_name(display_name) { } @@ -128,7 +128,8 @@ WebDragData WebDropData::ToDragData() const { item_list.push_back(item); } - for (std::map<string16, string16>::const_iterator it = custom_data.begin(); + for (std::map<base::string16, base::string16>::const_iterator it = + custom_data.begin(); it != custom_data.end(); ++it) { WebDragData::Item item; diff --git a/webkit/glue/webdropdata.h b/webkit/glue/webdropdata.h index 0f36d99..0df68f0 100644 --- a/webkit/glue/webdropdata.h +++ b/webkit/glue/webdropdata.h @@ -29,12 +29,12 @@ struct WEBKIT_GLUE_EXPORT WebDropData { // The struct is used to represent a file in the drop data. struct WEBKIT_GLUE_EXPORT FileInfo { FileInfo(); - FileInfo(const string16& path, const string16& display_name); + FileInfo(const base::string16& path, const base::string16& display_name); // The path of the file. - string16 path; + base::string16 path; // The display name of the file. This field is optional. - string16 display_name; + base::string16 display_name; }; // Construct from a WebDragData object. @@ -46,10 +46,10 @@ struct WEBKIT_GLUE_EXPORT WebDropData { // User is dragging a link into the webview. GURL url; - string16 url_title; // The title associated with |url|. + base::string16 url_title; // The title associated with |url|. // User is dragging a link out-of the webview. - string16 download_metadata; + base::string16 download_metadata; // Referrer policy to use when dragging a link out of the webview results in // a download. @@ -59,7 +59,7 @@ struct WEBKIT_GLUE_EXPORT WebDropData { std::vector<FileInfo> filenames; // Isolated filesystem ID for the files being dragged on the webview. - string16 filesystem_id; + base::string16 filesystem_id; // User is dragging plain text into the webview. NullableString16 text; @@ -71,10 +71,10 @@ struct WEBKIT_GLUE_EXPORT WebDropData { GURL html_base_url; // User is dragging data from the webview (e.g., an image). - string16 file_description_filename; + base::string16 file_description_filename; std::string file_contents; - std::map<string16, string16> custom_data; + std::map<base::string16, base::string16> custom_data; // Convert to a WebDragData object. WebKit::WebDragData ToDragData() const; diff --git a/webkit/glue/webdropdata_win.cc b/webkit/glue/webdropdata_win.cc index 9dd8306..193285c 100644 --- a/webkit/glue/webdropdata_win.cc +++ b/webkit/glue/webdropdata_win.cc @@ -14,23 +14,23 @@ // static void WebDropData::PopulateWebDropData(IDataObject* data_object, WebDropData* drop_data) { - string16 url_str; + base::string16 url_str; if (ui::ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, false)) { GURL test_url(url_str); if (test_url.is_valid()) drop_data->url = test_url; } - std::vector<string16> filenames; + std::vector<base::string16> filenames; ui::ClipboardUtil::GetFilenames(data_object, &filenames); for (size_t i = 0; i < filenames.size(); ++i) - drop_data->filenames.push_back(FileInfo(filenames[i], string16())); - string16 text; + drop_data->filenames.push_back(FileInfo(filenames[i], base::string16())); + base::string16 text; ui::ClipboardUtil::GetPlainText(data_object, &text); if (!text.empty()) { drop_data->text = NullableString16(text, false); } - string16 html; + base::string16 html; std::string html_base_url; ui::ClipboardUtil::GetHtml(data_object, &html, &html_base_url); if (!html.empty()) { diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 6572599..d3b260f 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -101,18 +101,18 @@ void EnableWebCoreLogChannels(const std::string& channels) { } } -string16 DumpDocumentText(WebFrame* web_frame) { +base::string16 DumpDocumentText(WebFrame* web_frame) { // We use the document element's text instead of the body text here because // not all documents have a body, such as XML documents. WebElement document_element = web_frame->document().documentElement(); if (document_element.isNull()) - return string16(); + return base::string16(); return document_element.innerText(); } -string16 DumpFramesAsText(WebFrame* web_frame, bool recursive) { - string16 result; +base::string16 DumpFramesAsText(WebFrame* web_frame, bool recursive) { + base::string16 result; // Add header for all but the main frame. Skip empty frames. if (web_frame->parent() && @@ -134,7 +134,7 @@ string16 DumpFramesAsText(WebFrame* web_frame, bool recursive) { return result; } -string16 DumpRenderer(WebFrame* web_frame) { +base::string16 DumpRenderer(WebFrame* web_frame) { return web_frame->renderTreeAsText(); } @@ -154,7 +154,7 @@ int NumberOfPages(WebFrame* web_frame, return number_of_pages; } -string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { +base::string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { gfx::Size offset = web_frame->scrollOffset(); std::string result_utf8; @@ -167,7 +167,7 @@ string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { offset.width(), offset.height()); } - string16 result = UTF8ToUTF16(result_utf8); + base::string16 result = UTF8ToUTF16(result_utf8); if (recursive) { WebFrame* child = web_frame->firstChild(); @@ -181,8 +181,8 @@ string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { // Returns True if item1 < item2. static bool HistoryItemCompareLess(const WebHistoryItem& item1, const WebHistoryItem& item2) { - string16 target1 = item1.target(); - string16 target2 = item2.target(); + base::string16 target1 = item1.target(); + base::string16 target2 = item2.target(); std::transform(target1.begin(), target1.end(), target1.begin(), tolower); std::transform(target2.begin(), target2.end(), target2.begin(), tolower); return target1 < target2; @@ -236,7 +236,7 @@ static std::string DumpHistoryItem(const WebHistoryItem& item, return result; } -string16 DumpHistoryState(const std::string& history_state, int indent, +base::string16 DumpHistoryState(const std::string& history_state, int indent, bool is_current) { return UTF8ToUTF16( DumpHistoryItem(HistoryItemFromString(history_state), indent, diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index f2d511b..59c7c17 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -40,15 +40,15 @@ WEBKIT_GLUE_EXPORT void SetJavaScriptFlags(const std::string& flags); WEBKIT_GLUE_EXPORT void EnableWebCoreLogChannels(const std::string& channels); // Returns the text of the document element. -WEBKIT_GLUE_EXPORT string16 DumpDocumentText(WebKit::WebFrame* web_frame); +WEBKIT_GLUE_EXPORT base::string16 DumpDocumentText(WebKit::WebFrame* web_frame); // Returns the text of the document element and optionally its child frames. // If recursive is false, this is equivalent to DumpDocumentText followed by // a newline. If recursive is true, it recursively dumps all frames as text. -string16 DumpFramesAsText(WebKit::WebFrame* web_frame, bool recursive); +base::string16 DumpFramesAsText(WebKit::WebFrame* web_frame, bool recursive); // Returns the renderer's description of its tree (its externalRepresentation). -WEBKIT_GLUE_EXPORT string16 DumpRenderer(WebKit::WebFrame* web_frame); +WEBKIT_GLUE_EXPORT base::string16 DumpRenderer(WebKit::WebFrame* web_frame); // Returns the number of page where the specified element will be put. int PageNumberForElementById(WebKit::WebFrame* web_frame, @@ -62,13 +62,15 @@ int NumberOfPages(WebKit::WebFrame* web_frame, float page_height_in_pixels); // Returns a dump of the scroll position of the webframe. -string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive); +base::string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, + bool recursive); // Returns a dump of the given history state suitable for implementing the // dumpBackForwardList command of the testRunner. -WEBKIT_GLUE_EXPORT string16 DumpHistoryState(const std::string& history_state, - int indent, - bool is_current); +WEBKIT_GLUE_EXPORT base::string16 DumpHistoryState( + const std::string& history_state, + int indent, + bool is_current); #ifndef NDEBUG // Checks various important objects to see if there are any in memory, and diff --git a/webkit/glue/webkit_glue_unittest.cc b/webkit/glue/webkit_glue_unittest.cc index 90fd31f..cca4497 100644 --- a/webkit/glue/webkit_glue_unittest.cc +++ b/webkit/glue/webkit_glue_unittest.cc @@ -64,8 +64,8 @@ class TestWebKitPlatformSupport } // WebKitPlatformSupportImpl implementation - virtual string16 GetLocalizedString(int) OVERRIDE { - return string16(); + virtual base::string16 GetLocalizedString(int) OVERRIDE { + return base::string16(); } virtual base::StringPiece GetDataResource(int, ui::ScaleFactor) OVERRIDE { diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc index fdadd74..0309fcf 100644 --- a/webkit/glue/webkitplatformsupport_impl.cc +++ b/webkit/glue/webkitplatformsupport_impl.cc @@ -709,7 +709,7 @@ WebString WebKitPlatformSupportImpl::queryLocalizedString( int message_id = ToMessageID(name); if (message_id < 0) return WebString(); - std::vector<string16> values; + std::vector<base::string16> values; values.reserve(2); values.push_back(value1); values.push_back(value2); diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h index 0f77447..3db2706 100644 --- a/webkit/glue/webkitplatformsupport_impl.h +++ b/webkit/glue/webkitplatformsupport_impl.h @@ -134,7 +134,7 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : // Gets a localized string given a message id. Returns an empty string if the // message id is not found. - virtual string16 GetLocalizedString(int message_id) = 0; + virtual base::string16 GetLocalizedString(int message_id) = 0; // Returns the raw data for a resource. This resource must have been // specified as BINDATA in the relevant .rc file. diff --git a/webkit/glue/webmenuitem.h b/webkit/glue/webmenuitem.h index 3b1e5d2..906ebdc 100644 --- a/webkit/glue/webmenuitem.h +++ b/webkit/glue/webmenuitem.h @@ -27,8 +27,8 @@ struct WEBKIT_GLUE_EXPORT WebMenuItem { WebMenuItem(const WebMenuItem& item); ~WebMenuItem(); - string16 label; - string16 toolTip; + base::string16 label; + base::string16 toolTip; Type type; unsigned action; bool rtl; diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index 15a60a1..2f7e158 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -171,49 +171,49 @@ WebPreferences::~WebPreferences() { namespace { void setStandardFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setStandardFontFamily(font, script); } void setFixedFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setFixedFontFamily(font, script); } void setSerifFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setSerifFontFamily(font, script); } void setSansSerifFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setSansSerifFontFamily(font, script); } void setCursiveFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setCursiveFontFamily(font, script); } void setFantasyFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setFantasyFontFamily(font, script); } void setPictographFontFamilyWrapper(WebSettings* settings, - const string16& font, + const base::string16& font, UScriptCode script) { settings->setPictographFontFamily(font, script); } typedef void (*SetFontFamilyWrapper)( - WebKit::WebSettings*, const string16&, UScriptCode); + WebKit::WebSettings*, const base::string16&, UScriptCode); // If |scriptCode| is a member of a family of "similar" script codes, returns // the script code in that family that is used by WebKit for font selection diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h index f67281d..4595c55 100644 --- a/webkit/glue/webpreferences.h +++ b/webkit/glue/webpreferences.h @@ -28,7 +28,7 @@ namespace webkit_glue { struct WEBKIT_GLUE_EXPORT WebPreferences { // Map of ISO 15924 four-letter script code to font family. For example, // "Arab" to "My Arabic Font". - typedef std::map<std::string, string16> ScriptFontFamilyMap; + typedef std::map<std::string, base::string16> ScriptFontFamilyMap; enum EditingBehavior { EDITING_BEHAVIOR_MAC, diff --git a/webkit/mocks/mock_webhyphenator.cc b/webkit/mocks/mock_webhyphenator.cc index 903197b..70e551a 100644 --- a/webkit/mocks/mock_webhyphenator.cc +++ b/webkit/mocks/mock_webhyphenator.cc @@ -57,7 +57,7 @@ size_t MockWebHyphenator::computeLastHyphenLocation( // Retrieve the positions where we can insert hyphens. This function assumes // the input word is an English word so it can use the position returned by // the hyphen library without conversion. - string16 word_utf16(characters, length); + base::string16 word_utf16(characters, length); if (!IsStringASCII(word_utf16)) return 0; std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16)); diff --git a/webkit/plugins/npapi/plugin_instance.cc b/webkit/plugins/npapi/plugin_instance.cc index 0fcdb19..8e61f70 100644 --- a/webkit/plugins/npapi/plugin_instance.cc +++ b/webkit/plugins/npapi/plugin_instance.cc @@ -177,7 +177,7 @@ NPObject *PluginInstance::GetPluginScriptableObject() { return value; } -bool PluginInstance::GetFormValue(string16* value) { +bool PluginInstance::GetFormValue(base::string16* value) { // Plugins will allocate memory for the return value by using NPN_MemAlloc(). char *plugin_value = NULL; NPError error = NPP_GetValue(NPPVformValue, &plugin_value); diff --git a/webkit/plugins/npapi/plugin_instance.h b/webkit/plugins/npapi/plugin_instance.h index 25a1da8..9e3fb32 100644 --- a/webkit/plugins/npapi/plugin_instance.h +++ b/webkit/plugins/npapi/plugin_instance.h @@ -152,7 +152,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { NPObject* GetPluginScriptableObject(); // Returns the form value of this instance. - bool GetFormValue(string16* value); + bool GetFormValue(base::string16* value); // WebViewDelegate methods that we implement. This is for handling // callbacks during getURLNotify. diff --git a/webkit/plugins/npapi/plugin_lib_unittest.cc b/webkit/plugins/npapi/plugin_lib_unittest.cc index 5d6c803..f78459a 100644 --- a/webkit/plugins/npapi/plugin_lib_unittest.cc +++ b/webkit/plugins/npapi/plugin_lib_unittest.cc @@ -125,7 +125,7 @@ TEST(MIMEDescriptionParse, CornerCases) { EXPECT_EQ("mime/type", types[0].mime_type); EXPECT_EQ(1U, types[0].file_extensions.size()); EXPECT_EQ("ext1", types[0].file_extensions[0]); - EXPECT_EQ(string16(), types[0].description); + EXPECT_EQ(base::string16(), types[0].description); } // This Java plugin has embedded semicolons in the mime type. diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index d82ae81..8856840 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -194,10 +194,10 @@ bool PluginList::ReadPluginInfo(const base::FilePath& filename, bool PluginList::ParseMimeTypes( const std::string& mime_types_str, const std::string& file_extensions_str, - const string16& mime_type_descriptions_str, + const base::string16& mime_type_descriptions_str, std::vector<webkit::WebPluginMimeType>* parsed_mime_types) { std::vector<std::string> mime_types, file_extensions; - std::vector<string16> descriptions; + std::vector<base::string16> descriptions; base::SplitString(mime_types_str, '|', &mime_types); base::SplitString(file_extensions_str, '|', &file_extensions); base::SplitString(mime_type_descriptions_str, '|', &descriptions); @@ -220,7 +220,7 @@ bool PluginList::ParseMimeTypes( // embedded in it (e.g. "SurfWriter file (*.swr)"). Remove an extension // list from the description if it is present. size_t ext = mime_type.description.find(ASCIIToUTF16("(*")); - if (ext != string16::npos) { + if (ext != base::string16::npos) { if (ext > 1 && mime_type.description[ext - 1] == ' ') ext--; diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index dcf7af7..ebdaf3a 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -121,7 +121,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { static bool ParseMimeTypes( const std::string& mime_types, const std::string& file_extensions, - const string16& mime_type_descriptions, + const base::string16& mime_type_descriptions, std::vector<webkit::WebPluginMimeType>* parsed_mime_types); // Get all the plugins synchronously, loading them if necessary. diff --git a/webkit/plugins/npapi/plugin_list_mac.mm b/webkit/plugins/npapi/plugin_list_mac.mm index 3bdbfc8..66f3296 100644 --- a/webkit/plugins/npapi/plugin_list_mac.mm +++ b/webkit/plugins/npapi/plugin_list_mac.mm @@ -52,7 +52,7 @@ bool IsBlacklistedPlugin(const WebPluginInfo& info) { // load them. if (StartsWith(info.name, ASCIIToUTF16("Flip4Mac Windows Media"), false) && StartsWith(info.version, ASCIIToUTF16("2.3"), false)) { - std::vector<string16> components; + std::vector<base::string16> components; base::SplitString(info.version, '.', &components); int bugfix_version = 0; return (components.size() >= 3 && diff --git a/webkit/plugins/npapi/plugin_list_unittest.cc b/webkit/plugins/npapi/plugin_list_unittest.cc index 0fc55bf..1358d19 100644 --- a/webkit/plugins/npapi/plugin_list_unittest.cc +++ b/webkit/plugins/npapi/plugin_list_unittest.cc @@ -71,8 +71,8 @@ TEST_F(PluginListTest, GetPlugins) { TEST_F(PluginListTest, BadPluginDescription) { WebPluginInfo plugin_3043( - string16(), base::FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), - string16(), string16()); + base::string16(), base::FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), + base::string16(), base::string16()); // Simulate loading of the plugins. plugin_list_.ClearPluginsToLoad(); plugin_list_.AddPluginToLoad(plugin_3043); diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc index dd7e036..d27d81c 100644 --- a/webkit/plugins/npapi/plugin_list_win.cc +++ b/webkit/plugins/npapi/plugin_list_win.cc @@ -70,12 +70,12 @@ void GetExeDirectory(std::set<base::FilePath>* plugin_dirs) { // Gets the installed path for a registered app. bool GetInstalledPath(const char16* app, base::FilePath* out) { - string16 reg_path(kRegistryApps); + base::string16 reg_path(kRegistryApps); reg_path.append(L"\\"); reg_path.append(app); base::win::RegKey hkcu_key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); - string16 path; + base::string16 path; // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf. if (base::win::GetVersion() >= base::win::VERSION_WIN7 && hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { @@ -95,17 +95,17 @@ bool GetInstalledPath(const char16* app, base::FilePath* out) { // Search the registry at the given path and detect plugin directories. void GetPluginsInRegistryDirectory( HKEY root_key, - const string16& registry_folder, + const base::string16& registry_folder, std::set<base::FilePath>* plugin_dirs) { for (base::win::RegistryKeyIterator iter(root_key, registry_folder.c_str()); iter.Valid(); ++iter) { // Use the registry to gather plugin across the file system. - string16 reg_path = registry_folder; + base::string16 reg_path = registry_folder; reg_path.append(L"\\"); reg_path.append(iter.Name()); base::win::RegKey key(root_key, reg_path.c_str(), KEY_READ); - string16 path; + base::string16 path; if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) plugin_dirs->insert(base::FilePath(path)); } @@ -117,10 +117,10 @@ void GetFirefoxInstalledPaths(std::vector<base::FilePath>* out) { base::win::RegistryKeyIterator it(HKEY_LOCAL_MACHINE, kRegistryFirefoxInstalled); for (; it.Valid(); ++it) { - string16 full_path = string16(kRegistryFirefoxInstalled) + L"\\" + - it.Name() + L"\\Main"; + base::string16 full_path = base::string16(kRegistryFirefoxInstalled) + + L"\\" + it.Name() + L"\\Main"; base::win::RegKey key(HKEY_LOCAL_MACHINE, full_path.c_str(), KEY_READ); - string16 install_dir; + base::string16 install_dir; if (key.ReadValue(L"Install Directory", &install_dir) != ERROR_SUCCESS) continue; out->push_back(base::FilePath(install_dir)); @@ -179,7 +179,7 @@ void GetJavaDirectory(std::set<base::FilePath>* plugin_dirs) { KEY_QUERY_VALUE); // 2. Read the current Java version - string16 java_version; + base::string16 java_version; if (java_key.ReadValue(kRegistryBrowserJavaVersion, &java_version) != ERROR_SUCCESS) { java_key.ReadValue(kRegistryCurrentJavaVersion, &java_version); @@ -190,7 +190,7 @@ void GetJavaDirectory(std::set<base::FilePath>* plugin_dirs) { // 3. Install path of the JRE binaries is specified in "JavaHome" // value under the Java version key. - string16 java_plugin_directory; + base::string16 java_plugin_directory; if (java_key.ReadValue(kRegistryJavaHome, &java_plugin_directory) == ERROR_SUCCESS) { // 4. The new plugin resides under the 'bin/new_plugin' @@ -234,8 +234,8 @@ bool HaveSharedMimeType(const webkit::WebPluginInfo& plugin1, // Compares Windows style version strings (i.e. 1,2,3,4). Returns true if b's // version is newer than a's, or false if it's equal or older. -bool IsNewerVersion(const string16& a, const string16& b) { - std::vector<string16> a_ver, b_ver; +bool IsNewerVersion(const base::string16& a, const base::string16& b) { + std::vector<base::string16> a_ver, b_ver; base::SplitString(a, ',', &a_ver); base::SplitString(b, ',', &b_ver); if (a_ver.size() == 1 && b_ver.size() == 1) { @@ -299,7 +299,7 @@ void PluginList::GetPluginsInDir( WIN32_FIND_DATA find_file_data; HANDLE find_handle; - string16 dir = path.value(); + base::string16 dir = path.value(); // FindFirstFile requires that you specify a wildcard for directories. dir.append(L"\\NP*.DLL"); diff --git a/webkit/plugins/npapi/plugin_utils.cc b/webkit/plugins/npapi/plugin_utils.cc index 88710a5..df6efa6 100644 --- a/webkit/plugins/npapi/plugin_utils.cc +++ b/webkit/plugins/npapi/plugin_utils.cc @@ -13,7 +13,7 @@ namespace webkit { namespace npapi { -void CreateVersionFromString(const string16& version_string, +void CreateVersionFromString(const base::string16& version_string, Version* parsed_version) { // Remove spaces and ')' from the version string, // Replace any instances of 'r', ',' or '(' with a dot. diff --git a/webkit/plugins/npapi/plugin_utils.h b/webkit/plugins/npapi/plugin_utils.h index 77e65e6..438e879 100644 --- a/webkit/plugins/npapi/plugin_utils.h +++ b/webkit/plugins/npapi/plugin_utils.h @@ -16,7 +16,7 @@ namespace npapi { // Parse a version string as used by a plug-in. This method is more lenient // in accepting weird version strings than Version::GetFromString() WEBKIT_PLUGINS_EXPORT void CreateVersionFromString( - const string16& version_string, + const base::string16& version_string, Version* parsed_version); // Returns true iff NPAPI plugins are supported on the current platform. diff --git a/webkit/plugins/npapi/webplugin_delegate.h b/webkit/plugins/npapi/webplugin_delegate.h index 6218415a7..4c0eb42 100644 --- a/webkit/plugins/npapi/webplugin_delegate.h +++ b/webkit/plugins/npapi/webplugin_delegate.h @@ -85,7 +85,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegate { // Gets the form value associated with the plugin instance. // Returns false if the value is not available. - virtual bool GetFormValue(string16* value) = 0; + virtual bool GetFormValue(base::string16* value) = 0; // Receives notification about a resource load that the plugin initiated // for a frame. diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/webkit/plugins/npapi/webplugin_delegate_impl.cc index 0c4ae87..08170a3 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl.cc @@ -185,7 +185,7 @@ NPObject* WebPluginDelegateImpl::GetPluginScriptableObject() { return instance_->GetPluginScriptableObject(); } -bool WebPluginDelegateImpl::GetFormValue(string16* value) { +bool WebPluginDelegateImpl::GetFormValue(base::string16* value) { return instance_->GetFormValue(value); } diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/webkit/plugins/npapi/webplugin_delegate_impl.h index aa95072..7afc9de 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.h +++ b/webkit/plugins/npapi/webplugin_delegate_impl.h @@ -85,9 +85,9 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { #if defined(OS_WIN) static bool IsPluginDelegateWindow(HWND window); static bool GetPluginNameFromWindow(HWND window, - string16* plugin_name); + base::string16* plugin_name); static bool GetPluginVersionFromWindow(HWND window, - string16* plugin_version); + base::string16* plugin_version); // Returns true if the window handle passed in is that of the dummy // activation window for windowless plugins. @@ -112,7 +112,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, WebKit::WebCursorInfo* cursor_info) OVERRIDE; virtual NPObject* GetPluginScriptableObject() OVERRIDE; - virtual bool GetFormValue(string16* value) OVERRIDE; + virtual bool GetFormValue(base::string16* value) OVERRIDE; virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, int notify_id) OVERRIDE; @@ -152,14 +152,14 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { #if defined(OS_WIN) // Informs the plug-in that an IME has changed its status. - void ImeCompositionUpdated(const string16& text, + void ImeCompositionUpdated(const base::string16& text, const std::vector<int>& clauses, const std::vector<int>& target, int cursor_position); // Informs the plugin that IME composition has completed./ If |text| is empty, // IME was cancelled. - void ImeCompositionCompleted(const string16& text); + void ImeCompositionCompleted(const base::string16& text); // Returns the IME status retrieved from a plug-in. bool GetIMEStatus(int* input_type, gfx::Rect* caret_rect); @@ -186,7 +186,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { const gfx::Rect& view_frame); // Informs the plugin that IME composition has completed. // If |text| is empty, IME was cancelled. - void ImeCompositionCompleted(const string16& text); + void ImeCompositionCompleted(const base::string16& text); // Informs the delegate that the plugin set a Cocoa NSCursor. void SetNSCursor(NSCursor* cursor); diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm index e8594f8..1ecbc85 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm +++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm @@ -229,7 +229,8 @@ bool WebPluginDelegateImpl::PlatformInitialize() { // that behavior here. const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); - if (plugin_info.name.find(ASCIIToUTF16("Flash")) != string16::npos) + if (plugin_info.name.find(ASCIIToUTF16("Flash")) != + base::string16::npos) gpu_preference = gfx::PreferIntegratedGpu; surface_ = plugin_->GetAcceleratedSurface(gpu_preference); @@ -615,7 +616,8 @@ void WebPluginDelegateImpl::WindowFrameChanged(const gfx::Rect& window_frame, SetContentAreaOrigin(gfx::Point(view_frame.x(), view_frame.y())); } -void WebPluginDelegateImpl::ImeCompositionCompleted(const string16& text) { +void WebPluginDelegateImpl::ImeCompositionCompleted( + const base::string16& text) { ime_enabled_ = false; // If |text| is empty this was just called to tell us composition was diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc index 02d44ac..72abf8a 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc @@ -203,7 +203,7 @@ int GetPluginMajorVersion(const WebPluginInfo& plugin_info) { bool GetPluginPropertyFromWindow( HWND window, const wchar_t* plugin_atom_property, - string16* plugin_property) { + base::string16* plugin_property) { ATOM plugin_atom = reinterpret_cast<ATOM>( GetPropW(window, plugin_atom_property)); if (plugin_atom != 0) { @@ -220,12 +220,12 @@ bool GetPluginPropertyFromWindow( } // namespace bool WebPluginDelegateImpl::IsPluginDelegateWindow(HWND window) { - return ui::GetClassName(window) == string16(kNativeWindowClassName); + return ui::GetClassName(window) == base::string16(kNativeWindowClassName); } // static bool WebPluginDelegateImpl::GetPluginNameFromWindow( - HWND window, string16* plugin_name) { + HWND window, base::string16* plugin_name) { return IsPluginDelegateWindow(window) && GetPluginPropertyFromWindow( window, kPluginNameAtomProperty, plugin_name); @@ -233,7 +233,7 @@ bool WebPluginDelegateImpl::GetPluginNameFromWindow( // static bool WebPluginDelegateImpl::GetPluginVersionFromWindow( - HWND window, string16* plugin_version) { + HWND window, base::string16* plugin_version) { return IsPluginDelegateWindow(window) && GetPluginPropertyFromWindow( window, kPluginVersionAtomProperty, plugin_version); @@ -560,7 +560,7 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); } - string16 plugin_version = plugin_lib->plugin_info().version; + base::string16 plugin_version = plugin_lib->plugin_info().version; if (!plugin_version.empty()) { ATOM plugin_version_atom = GlobalAddAtomW(plugin_version.c_str()); DCHECK_NE(0, plugin_version_atom); @@ -1477,7 +1477,7 @@ LONG WINAPI WebPluginDelegateImpl::RegEnumKeyExWPatch( } void WebPluginDelegateImpl::ImeCompositionUpdated( - const string16& text, + const base::string16& text, const std::vector<int>& clauses, const std::vector<int>& target, int cursor_position) { @@ -1488,7 +1488,8 @@ void WebPluginDelegateImpl::ImeCompositionUpdated( plugin_ime_->SendEvents(instance()); } -void WebPluginDelegateImpl::ImeCompositionCompleted(const string16& text) { +void WebPluginDelegateImpl::ImeCompositionCompleted( + const base::string16& text) { if (!plugin_ime_.get()) plugin_ime_.reset(new WebPluginIMEWin); plugin_ime_->CompositionCompleted(text); diff --git a/webkit/plugins/npapi/webplugin_ime_win.cc b/webkit/plugins/npapi/webplugin_ime_win.cc index 10c5281..46bfaa9 100644 --- a/webkit/plugins/npapi/webplugin_ime_win.cc +++ b/webkit/plugins/npapi/webplugin_ime_win.cc @@ -40,7 +40,7 @@ WebPluginIMEWin::WebPluginIMEWin() WebPluginIMEWin::~WebPluginIMEWin() { } -void WebPluginIMEWin::CompositionUpdated(const string16& text, +void WebPluginIMEWin::CompositionUpdated(const base::string16& text, std::vector<int> clauses, std::vector<int> target, int cursor_position) { @@ -88,7 +88,7 @@ void WebPluginIMEWin::CompositionUpdated(const string16& text, delta_start_ = cursor_position; } -void WebPluginIMEWin::CompositionCompleted(const string16& text) { +void WebPluginIMEWin::CompositionCompleted(const base::string16& text) { composing_text_ = false; // We should update the following values when we finish a composition: diff --git a/webkit/plugins/npapi/webplugin_ime_win.h b/webkit/plugins/npapi/webplugin_ime_win.h index 123231d..0b20584 100644 --- a/webkit/plugins/npapi/webplugin_ime_win.h +++ b/webkit/plugins/npapi/webplugin_ime_win.h @@ -51,7 +51,7 @@ class PluginInstance; // // WebPluginIMEWin ime; // ... -// string16 text = "composing"; +// base::string16 text = "composing"; // std::vector<int> clauses; // clauses.push_back(0); // clauses.push_back(text.length()); @@ -59,7 +59,7 @@ class PluginInstance; // ime.CompositionUpdated(text, clauses, target, text.length()); // ime.SendEvents(instance()); // -// string16 result = "result"; +// base::string16 result = "result"; // ime.CompositionCompleted(result); // ime.SendEvents(instance()); // @@ -94,11 +94,11 @@ class WebPluginIMEWin { // mapped to two or more Windows events and it is not so trivial to send these // Windows events to a plug-in. This function inserts Windows events in the // order expected by a plug-in. - void CompositionUpdated(const string16& text, + void CompositionUpdated(const base::string16& text, std::vector<int> clauses, std::vector<int> target, int cursor_position); - void CompositionCompleted(const string16& text); + void CompositionCompleted(const base::string16& text); // Send all the events added in Update() to a plug-in. bool SendEvents(PluginInstance* instance); @@ -141,10 +141,10 @@ class WebPluginIMEWin { std::vector<NPEvent> events_; // The return value for GCS_COMPSTR. - string16 composition_text_; + base::string16 composition_text_; // The return value for GCS_RESULTSTR. - string16 result_text_; + base::string16 result_text_; // The return value for GCS_COMPATTR. std::string composition_attributes_; diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index 1b4615b..8894f63 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -282,7 +282,7 @@ NPObject* WebPluginImpl::scriptableObject() { bool WebPluginImpl::getFormValue(WebKit::WebString& value) { if (!delegate_) return false; - string16 form_value; + base::string16 form_value; if (!delegate_->GetFormValue(&form_value)) return false; value = form_value; diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc index 3fac5d1..a0f9730 100644 --- a/webkit/plugins/ppapi/event_conversion.cc +++ b/webkit/plugins/ppapi/event_conversion.cc @@ -369,7 +369,7 @@ WebKeyboardEvent* BuildCharEvent(const InputEventData& event) { // Make sure to not read beyond the buffer in case some bad code doesn't // NULL-terminate it (this is called from plugins). size_t text_length_cap = WebKeyboardEvent::textLengthCap; - string16 text16 = UTF8ToUTF16(event.character_text); + base::string16 text16 = UTF8ToUTF16(event.character_text); memset(key_event->text, 0, text_length_cap); memset(key_event->unmodifiedText, 0, text_length_cap); diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 137c061..07c963e 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -40,13 +40,14 @@ void MockPluginDelegate::PluginSelectionChanged(PluginInstance* instance) { } void MockPluginDelegate::SimulateImeSetComposition( - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end) { } -void MockPluginDelegate::SimulateImeConfirmComposition(const string16& text) { +void MockPluginDelegate::SimulateImeConfirmComposition( + const base::string16& text) { } void MockPluginDelegate::PluginCrashed(PluginInstance* instance) { diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index b26ad9f..4de2a6b 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -24,11 +24,11 @@ class MockPluginDelegate : public PluginDelegate { virtual void PluginRequestedCancelComposition(PluginInstance* instance); virtual void PluginSelectionChanged(PluginInstance* instance); virtual void SimulateImeSetComposition( - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end); - virtual void SimulateImeConfirmComposition(const string16& text); + virtual void SimulateImeConfirmComposition(const base::string16& text); virtual void PluginCrashed(PluginInstance* instance); virtual void InstanceCreated(PluginInstance* instance); virtual void InstanceDeleted(PluginInstance* instance); diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index 1c861e8..3a8a724 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -362,11 +362,11 @@ class PluginDelegate { webkit::ppapi::PluginInstance* instance) = 0; // Requests simulating IME events for testing purpose. virtual void SimulateImeSetComposition( - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end) = 0; - virtual void SimulateImeConfirmComposition(const string16& text) = 0; + virtual void SimulateImeConfirmComposition(const base::string16& text) = 0; // Notification that the given plugin has crashed. When a plugin crashes, all // instances associated with that plugin will notify that they've crashed via diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index d85c05e..5ad3aa7 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -603,7 +603,7 @@ bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) { } bool PluginInstance::SendCompositionEventToPlugin(PP_InputEvent_Type type, - const string16& text) { + const base::string16& text) { std::vector<WebKit::WebCompositionUnderline> empty; return SendCompositionEventWithUnderlineInformationToPlugin( type, text, empty, static_cast<int>(text.size()), @@ -612,7 +612,7 @@ bool PluginInstance::SendCompositionEventToPlugin(PP_InputEvent_Type type, bool PluginInstance::SendCompositionEventWithUnderlineInformationToPlugin( PP_InputEvent_Type type, - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end) { @@ -693,13 +693,13 @@ void PluginInstance::RequestInputEventsHelper(uint32_t event_classes) { container_->setWantsWheelEvents(IsAcceptingWheelEvents()); } -bool PluginInstance::HandleCompositionStart(const string16& text) { +bool PluginInstance::HandleCompositionStart(const base::string16& text) { return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START, text); } bool PluginInstance::HandleCompositionUpdate( - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end) { @@ -708,24 +708,26 @@ bool PluginInstance::HandleCompositionUpdate( text, underlines, selection_start, selection_end); } -bool PluginInstance::HandleCompositionEnd(const string16& text) { +bool PluginInstance::HandleCompositionEnd(const base::string16& text) { return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_END, text); } -bool PluginInstance::HandleTextInput(const string16& text) { +bool PluginInstance::HandleTextInput(const base::string16& text) { return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_TEXT, text); } -void PluginInstance::GetSurroundingText(string16* text, +void PluginInstance::GetSurroundingText(base::string16* text, ui::Range* range) const { std::vector<size_t> offsets; offsets.push_back(selection_anchor_); offsets.push_back(selection_caret_); *text = base::UTF8ToUTF16AndAdjustOffsets(surrounding_text_, &offsets); - range->set_start(offsets[0] == string16::npos ? text->size() : offsets[0]); - range->set_end(offsets[1] == string16::npos ? text->size() : offsets[1]); + range->set_start(offsets[0] == base::string16::npos ? text->size() + : offsets[0]); + range->set_end(offsets[1] == base::string16::npos ? text->size() + : offsets[1]); } bool PluginInstance::IsPluginAcceptingCompositionEvents() const { @@ -994,16 +996,16 @@ bool PluginInstance::GetBitmapForOptimizedPluginPaint( return true; } -string16 PluginInstance::GetSelectedText(bool html) { +base::string16 PluginInstance::GetSelectedText(bool html) { // Keep a reference on the stack. See NOTE above. scoped_refptr<PluginInstance> ref(this); if (!LoadSelectionInterface()) - return string16(); + return base::string16(); PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), PP_FromBool(html)); StringVar* string = StringVar::FromPPVar(rv); - string16 selection; + base::string16 selection; if (string) selection = UTF8ToUTF16(string->value()); // Release the ref the plugin transfered to us. @@ -1011,18 +1013,18 @@ string16 PluginInstance::GetSelectedText(bool html) { return selection; } -string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { +base::string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { // Keep a reference on the stack. See NOTE above. scoped_refptr<PluginInstance> ref(this); if (!LoadPdfInterface()) - return string16(); + return base::string16(); PP_Point p; p.x = point.x(); p.y = point.y(); PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p); StringVar* string = StringVar::FromPPVar(rv); - string16 link; + base::string16 link; if (string) link = UTF8ToUTF16(string->value()); // Release the ref the plugin transfered to us. @@ -1048,7 +1050,7 @@ void PluginInstance::Zoom(double factor, bool text_only) { plugin_zoom_interface_->Zoom(pp_instance(), factor, PP_FromBool(text_only)); } -bool PluginInstance::StartFind(const string16& search_text, +bool PluginInstance::StartFind(const base::string16& search_text, bool case_sensitive, int identifier) { // Keep a reference on the stack. See NOTE above. @@ -1835,7 +1837,7 @@ void PluginInstance::SimulateImeSetCompositionEvent( input_event.composition_segment_offsets.begin(), input_event.composition_segment_offsets.end()); - string16 utf16_text = + base::string16 utf16_text = base::UTF8ToUTF16AndAdjustOffsets(input_event.character_text, &offsets); std::vector<WebKit::WebCompositionUnderline> underlines; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 0b906a6b..b6456ba 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -185,20 +185,20 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : const std::vector<gfx::Rect>& cut_outs_rects); // Handlers for composition events. - bool HandleCompositionStart(const string16& text); + bool HandleCompositionStart(const base::string16& text); bool HandleCompositionUpdate( - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end); - bool HandleCompositionEnd(const string16& text); - bool HandleTextInput(const string16& text); + bool HandleCompositionEnd(const base::string16& text); + bool HandleTextInput(const base::string16& text); // Gets the current text input status. ui::TextInputType text_input_type() const { return text_input_type_; } gfx::Rect GetCaretBounds() const; bool IsPluginAcceptingCompositionEvents() const; - void GetSurroundingText(string16* text, ui::Range* range) const; + void GetSurroundingText(base::string16* text, ui::Range* range) const; // Notifications about focus changes, see has_webkit_focus_ below. void SetWebKitFocus(bool has_focus); @@ -229,11 +229,11 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : void AddPluginObject(PluginObject* plugin_object); void RemovePluginObject(PluginObject* plugin_object); - string16 GetSelectedText(bool html); - string16 GetLinkAtPosition(const gfx::Point& point); + base::string16 GetSelectedText(bool html); + base::string16 GetLinkAtPosition(const gfx::Point& point); void RequestSurroundingText(size_t desired_number_of_characters); void Zoom(double factor, bool text_only); - bool StartFind(const string16& search_text, + bool StartFind(const base::string16& search_text, bool case_sensitive, int identifier); void SelectFindResult(bool forward); @@ -565,10 +565,10 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // Internal helper functions for HandleCompositionXXX(). bool SendCompositionEventToPlugin( PP_InputEvent_Type type, - const string16& text); + const base::string16& text); bool SendCompositionEventWithUnderlineInformationToPlugin( PP_InputEvent_Type type, - const string16& text, + const base::string16& text, const std::vector<WebKit::WebCompositionUnderline>& underlines, int selection_start, int selection_end); diff --git a/webkit/plugins/webplugininfo.cc b/webkit/plugins/webplugininfo.cc index a581647..be80fcf 100644 --- a/webkit/plugins/webplugininfo.cc +++ b/webkit/plugins/webplugininfo.cc @@ -50,10 +50,10 @@ WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) { return *this; } -WebPluginInfo::WebPluginInfo(const string16& fake_name, +WebPluginInfo::WebPluginInfo(const base::string16& fake_name, const base::FilePath& fake_path, - const string16& fake_version, - const string16& fake_desc) + const base::string16& fake_version, + const base::string16& fake_desc) : name(fake_name), path(fake_path), version(fake_version), diff --git a/webkit/plugins/webplugininfo.h b/webkit/plugins/webplugininfo.h index b08e349..10ada2c 100644 --- a/webkit/plugins/webplugininfo.h +++ b/webkit/plugins/webplugininfo.h @@ -30,11 +30,11 @@ struct WEBKIT_PLUGINS_EXPORT WebPluginMimeType { std::vector<std::string> file_extensions; // Description of the mime type. - string16 description; + base::string16 description; // Extra parameters to include when instantiating the plugin. - std::vector<string16> additional_param_names; - std::vector<string16> additional_param_values; + std::vector<base::string16> additional_param_names; + std::vector<base::string16> additional_param_values; }; // Describes an available NPAPI or Pepper plugin. @@ -52,22 +52,22 @@ struct WEBKIT_PLUGINS_EXPORT WebPluginInfo { WebPluginInfo& operator=(const WebPluginInfo& rhs); // Special constructor only used during unit testing: - WebPluginInfo(const string16& fake_name, + WebPluginInfo(const base::string16& fake_name, const base::FilePath& fake_path, - const string16& fake_version, - const string16& fake_desc); + const base::string16& fake_version, + const base::string16& fake_desc); // The name of the plugin (i.e. Flash). - string16 name; + base::string16 name; // The path to the plugin file (DLL/bundle/library). base::FilePath path; // The version number of the plugin file (may be OS-specific) - string16 version; + base::string16 version; // A description of the plugin that we get from its version info. - string16 desc; + base::string16 desc; // A list of all the mime types that this plugin supports. std::vector<WebPluginMimeType> mime_types; diff --git a/webkit/support/platform_support_android.cc b/webkit/support/platform_support_android.cc index 0acc1ab..d192ce9 100644 --- a/webkit/support/platform_support_android.cc +++ b/webkit/support/platform_support_android.cc @@ -91,7 +91,7 @@ void AfterShutdown() { } // namespace webkit_support -string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { +base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); } diff --git a/webkit/support/platform_support_linux.cc b/webkit/support/platform_support_linux.cc index ce622ea..2b6d0b5 100644 --- a/webkit/support/platform_support_linux.cc +++ b/webkit/support/platform_support_linux.cc @@ -38,7 +38,7 @@ void AfterShutdown() { } // namespace webkit_support -string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { +base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); } diff --git a/webkit/support/platform_support_mac.mm b/webkit/support/platform_support_mac.mm index 2681cb4..80317d1 100644 --- a/webkit/support/platform_support_mac.mm +++ b/webkit/support/platform_support_mac.mm @@ -173,24 +173,24 @@ void AfterShutdown() { } // namespace webkit_support -string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { +base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { // |g_resource_data_pack| is null on unit tests. // But som unit tests reach GetLocalizedString(). if (!g_resource_data_pack) - return string16(); + return base::string16(); base::StringPiece res; if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { LOG(FATAL) << "failed to load webkit string with id " << message_id; } // Data packs hold strings as either UTF8 or UTF16. - string16 msg; + base::string16 msg; switch (g_resource_data_pack->GetTextEncodingType()) { case ui::DataPack::UTF8: msg = UTF8ToUTF16(res); break; case ui::DataPack::UTF16: - msg = string16(reinterpret_cast<const char16*>(res.data()), + msg = base::string16(reinterpret_cast<const char16*>(res.data()), res.length() / 2); break; case ui::DataPack::BINARY: diff --git a/webkit/support/platform_support_win.cc b/webkit/support/platform_support_win.cc index f5d03aa..01bf814 100644 --- a/webkit/support/platform_support_win.cc +++ b/webkit/support/platform_support_win.cc @@ -69,7 +69,7 @@ void AfterShutdown() { } // namespace webkit_support -string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { +base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { wchar_t localized[MAX_LOADSTRING]; int length = ::LoadString(::GetModuleHandle(NULL), message_id, localized, MAX_LOADSTRING); @@ -77,7 +77,7 @@ string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { NOTREACHED(); return L"No string for this identifier!"; } - return string16(localized, length); + return base::string16(localized, length); } base::StringPiece TestWebKitPlatformSupport::GetDataResource( diff --git a/webkit/support/simple_database_system.cc b/webkit/support/simple_database_system.cc index 88e088c..db20ebe 100644 --- a/webkit/support/simple_database_system.cc +++ b/webkit/support/simple_database_system.cc @@ -56,8 +56,9 @@ SimpleDatabaseSystem::~SimpleDatabaseSystem() { } void SimpleDatabaseSystem::databaseOpened(const WebKit::WebDatabase& database) { - string16 origin_identifier = database.securityOrigin().databaseIdentifier(); - string16 database_name = database.name(); + base::string16 origin_identifier = + database.securityOrigin().databaseIdentifier(); + base::string16 database_name = database.name(); open_connections_->AddOpenConnection(origin_identifier, database_name); db_thread_proxy_->PostTask( FROM_HERE, @@ -79,8 +80,9 @@ void SimpleDatabaseSystem::databaseModified( } void SimpleDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database) { - string16 origin_identifier = database.securityOrigin().databaseIdentifier(); - string16 database_name = database.name(); + base::string16 origin_identifier = + database.securityOrigin().databaseIdentifier(); + base::string16 database_name = database.name(); db_thread_proxy_->PostTask( FROM_HERE, base::Bind(&SimpleDatabaseSystem::DatabaseClosed, @@ -88,7 +90,7 @@ void SimpleDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database) { } base::PlatformFile SimpleDatabaseSystem::OpenFile( - const string16& vfs_file_name, int desired_flags) { + const base::string16& vfs_file_name, int desired_flags) { base::PlatformFile result = base::kInvalidPlatformFileValue; base::WaitableEvent done_event(false, false); db_thread_proxy_->PostTask( @@ -102,7 +104,7 @@ base::PlatformFile SimpleDatabaseSystem::OpenFile( } int SimpleDatabaseSystem::DeleteFile( - const string16& vfs_file_name, bool sync_dir) { + const base::string16& vfs_file_name, bool sync_dir) { int result = SQLITE_OK; base::WaitableEvent done_event(false, false); db_thread_proxy_->PostTask( @@ -115,7 +117,8 @@ int SimpleDatabaseSystem::DeleteFile( return result; } -uint32 SimpleDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) { +uint32 SimpleDatabaseSystem::GetFileAttributes( + const base::string16& vfs_file_name) { uint32 result = 0; base::WaitableEvent done_event(false, false); db_thread_proxy_->PostTask( @@ -126,7 +129,7 @@ uint32 SimpleDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) { return result; } -int64 SimpleDatabaseSystem::GetFileSize(const string16& vfs_file_name) { +int64 SimpleDatabaseSystem::GetFileSize(const base::string16& vfs_file_name) { int64 result = 0; base::WaitableEvent done_event(false, false); db_thread_proxy_->PostTask( @@ -138,7 +141,7 @@ int64 SimpleDatabaseSystem::GetFileSize(const string16& vfs_file_name) { } int64 SimpleDatabaseSystem::GetSpaceAvailable( - const string16& origin_identifier) { + const base::string16& origin_identifier) { int64 result = 0; base::WaitableEvent done_event(false, false); db_thread_proxy_->PostTask( @@ -168,10 +171,11 @@ void SimpleDatabaseSystem::SetDatabaseQuota(int64 quota) { quota_per_origin_ = quota; } -void SimpleDatabaseSystem::DatabaseOpened(const string16& origin_identifier, - const string16& database_name, - const string16& description, - int64 estimated_size) { +void SimpleDatabaseSystem::DatabaseOpened( + const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& description, + int64 estimated_size) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); int64 database_size = 0; db_tracker_->DatabaseOpened( @@ -181,22 +185,24 @@ void SimpleDatabaseSystem::DatabaseOpened(const string16& origin_identifier, database_size); } -void SimpleDatabaseSystem::DatabaseModified(const string16& origin_identifier, - const string16& database_name) { +void SimpleDatabaseSystem::DatabaseModified( + const base::string16& origin_identifier, + const base::string16& database_name) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); db_tracker_->DatabaseModified(origin_identifier, database_name); } -void SimpleDatabaseSystem::DatabaseClosed(const string16& origin_identifier, - const string16& database_name) { +void SimpleDatabaseSystem::DatabaseClosed( + const base::string16& origin_identifier, + const base::string16& database_name) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); db_tracker_->DatabaseClosed(origin_identifier, database_name); open_connections_->RemoveOpenConnection(origin_identifier, database_name); } void SimpleDatabaseSystem::OnDatabaseSizeChanged( - const string16& origin_identifier, - const string16& database_name, + const base::string16& origin_identifier, + const base::string16& database_name, int64 database_size) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); // We intentionally call into webkit on our background db_thread_ @@ -207,8 +213,8 @@ void SimpleDatabaseSystem::OnDatabaseSizeChanged( } void SimpleDatabaseSystem::OnDatabaseScheduledForDeletion( - const string16& origin_identifier, - const string16& database_name) { + const base::string16& origin_identifier, + const base::string16& database_name) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); // We intentionally call into webkit on our background db_thread_ // to better emulate what happens in chrome where this method is @@ -218,7 +224,7 @@ void SimpleDatabaseSystem::OnDatabaseScheduledForDeletion( } void SimpleDatabaseSystem::VfsOpenFile( - const string16& vfs_file_name, int desired_flags, + const base::string16& vfs_file_name, int desired_flags, base::PlatformFile* file_handle, base::WaitableEvent* done_event ) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); base::FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name); @@ -232,7 +238,7 @@ void SimpleDatabaseSystem::VfsOpenFile( } void SimpleDatabaseSystem::VfsDeleteFile( - const string16& vfs_file_name, bool sync_dir, + const base::string16& vfs_file_name, bool sync_dir, int* result, base::WaitableEvent* done_event) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); // We try to delete the file multiple times, because that's what the default @@ -254,7 +260,7 @@ void SimpleDatabaseSystem::VfsDeleteFile( } void SimpleDatabaseSystem::VfsGetFileAttributes( - const string16& vfs_file_name, + const base::string16& vfs_file_name, uint32* result, base::WaitableEvent* done_event) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); *result = VfsBackend::GetFileAttributes( @@ -263,7 +269,7 @@ void SimpleDatabaseSystem::VfsGetFileAttributes( } void SimpleDatabaseSystem::VfsGetFileSize( - const string16& vfs_file_name, + const base::string16& vfs_file_name, int64* result, base::WaitableEvent* done_event) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); *result = VfsBackend::GetFileSize(GetFullFilePathForVfsFile(vfs_file_name)); @@ -271,7 +277,7 @@ void SimpleDatabaseSystem::VfsGetFileSize( } void SimpleDatabaseSystem::VfsGetSpaceAvailable( - const string16& origin_identifier, + const base::string16& origin_identifier, int64* result, base::WaitableEvent* done_event) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); // This method isn't actually part of the "vfs" interface, but it is @@ -288,7 +294,7 @@ void SimpleDatabaseSystem::VfsGetSpaceAvailable( } base::FilePath SimpleDatabaseSystem::GetFullFilePathForVfsFile( - const string16& vfs_file_name) { + const base::string16& vfs_file_name) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); if (vfs_file_name.empty()) // temp file, used for vacuuming return base::FilePath(); diff --git a/webkit/support/simple_database_system.h b/webkit/support/simple_database_system.h index 8a40c3f..000ff9c 100644 --- a/webkit/support/simple_database_system.h +++ b/webkit/support/simple_database_system.h @@ -39,11 +39,12 @@ class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer, // SQLite VFS related methods, these are called on webcore's // background database threads via the WebKitPlatformSupport impl. - base::PlatformFile OpenFile(const string16& vfs_file_name, int desired_flags); - int DeleteFile(const string16& vfs_file_name, bool sync_dir); - uint32 GetFileAttributes(const string16& vfs_file_name); - int64 GetFileSize(const string16& vfs_file_name); - int64 GetSpaceAvailable(const string16& origin_identifier); + base::PlatformFile OpenFile(const base::string16& vfs_file_name, + int desired_flags); + int DeleteFile(const base::string16& vfs_file_name, bool sync_dir); + uint32 GetFileAttributes(const base::string16& vfs_file_name); + int64 GetFileSize(const base::string16& vfs_file_name); + int64 GetSpaceAvailable(const base::string16& origin_identifier); // For use by testRunner, called on the main thread. void ClearAllDatabases(); @@ -51,36 +52,36 @@ class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer, private: // Used by our WebDatabaseObserver impl, only called on the db_thread - void DatabaseOpened(const string16& origin_identifier, - const string16& database_name, - const string16& description, + void DatabaseOpened(const base::string16& origin_identifier, + const base::string16& database_name, + const base::string16& description, int64 estimated_size); - void DatabaseModified(const string16& origin_identifier, - const string16& database_name); - void DatabaseClosed(const string16& origin_identifier, - const string16& database_name); + void DatabaseModified(const base::string16& origin_identifier, + const base::string16& database_name); + void DatabaseClosed(const base::string16& origin_identifier, + const base::string16& database_name); // DatabaseTracker::Observer implementation - virtual void OnDatabaseSizeChanged(const string16& origin_identifier, - const string16& database_name, + virtual void OnDatabaseSizeChanged(const base::string16& origin_identifier, + const base::string16& database_name, int64 database_size) OVERRIDE; virtual void OnDatabaseScheduledForDeletion( - const string16& origin_identifier, - const string16& database_name) OVERRIDE; + const base::string16& origin_identifier, + const base::string16& database_name) OVERRIDE; // Used by our public SQLite VFS methods, only called on the db_thread. - void VfsOpenFile(const string16& vfs_file_name, int desired_flags, + void VfsOpenFile(const base::string16& vfs_file_name, int desired_flags, base::PlatformFile* result, base::WaitableEvent* done_event); - void VfsDeleteFile(const string16& vfs_file_name, bool sync_dir, + void VfsDeleteFile(const base::string16& vfs_file_name, bool sync_dir, int* result, base::WaitableEvent* done_event); - void VfsGetFileAttributes(const string16& vfs_file_name, + void VfsGetFileAttributes(const base::string16& vfs_file_name, uint32* result, base::WaitableEvent* done_event); - void VfsGetFileSize(const string16& vfs_file_name, + void VfsGetFileSize(const base::string16& vfs_file_name, int64* result, base::WaitableEvent* done_event); - void VfsGetSpaceAvailable(const string16& origin_identifier, + void VfsGetSpaceAvailable(const base::string16& origin_identifier, int64* result, base::WaitableEvent* done_event); - base::FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name); + base::FilePath GetFullFilePathForVfsFile(const base::string16& vfs_file_name); void ResetTracker(); void ThreadCleanup(base::WaitableEvent* done_event); diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h index 38f1210..cefc62c 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -119,7 +119,7 @@ class TestWebKitPlatformSupport : virtual void sampleGamepads(WebKit::WebGamepads& data); void setGamepadData(const WebKit::WebGamepads& data); - virtual string16 GetLocalizedString(int message_id) OVERRIDE; + virtual base::string16 GetLocalizedString(int message_id) OVERRIDE; virtual base::StringPiece GetDataResource( int resource_id, ui::ScaleFactor scale_factor) OVERRIDE; diff --git a/webkit/tools/test_shell/mock_spellcheck.cc b/webkit/tools/test_shell/mock_spellcheck.cc index cc05c16..fac0dfb 100644 --- a/webkit/tools/test_shell/mock_spellcheck.cc +++ b/webkit/tools/test_shell/mock_spellcheck.cc @@ -19,7 +19,7 @@ MockSpellCheck::MockSpellCheck() MockSpellCheck::~MockSpellCheck() { } -bool MockSpellCheck::SpellCheckWord(const string16& text, +bool MockSpellCheck::SpellCheckWord(const base::string16& text, int* misspelledOffset, int* misspelledLength) { DCHECK(misspelledOffset && misspelledLength); @@ -43,7 +43,7 @@ bool MockSpellCheck::SpellCheckWord(const string16& text, // don't have misspelled contractions. static const char* kWordCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - string16 word_characters(ASCIIToUTF16(kWordCharacters)); + base::string16 word_characters(ASCIIToUTF16(kWordCharacters)); size_t word_offset = text.find_first_of(word_characters); if (word_offset == std::string::npos) @@ -58,8 +58,8 @@ bool MockSpellCheck::SpellCheckWord(const string16& text, // extracted word if this word is a known misspelled word. // (See the comment in MockSpellCheck::InitializeIfNeeded() why we use a // misspelled-word table.) - string16 word(text, word_offset, word_length); - std::map<string16, bool>::iterator it = misspelled_words_.find(word); + base::string16 word(text, word_offset, word_length); + std::map<base::string16, bool>::iterator it = misspelled_words_.find(word); if (it == misspelled_words_.end()) return true; @@ -113,7 +113,7 @@ bool MockSpellCheck::InitializeIfNeeded() { misspelled_words_.clear(); for (size_t i = 0; i < arraysize(kMisspelledWords); ++i) { - misspelled_words_.insert(std::make_pair<string16, bool>( + misspelled_words_.insert(std::make_pair<base::string16, bool>( ASCIIToUTF16(kMisspelledWords[i]), false)); } @@ -126,8 +126,8 @@ bool MockSpellCheck::InitializeIfNeeded() { return false; } -void MockSpellCheck::FillSuggestions(const string16& word, - std::vector<string16>* suggestions) { +void MockSpellCheck::FillSuggestions(const base::string16& word, + std::vector<base::string16>* suggestions) { if (word == ASCIIToUTF16("wellcome")) suggestions->push_back(ASCIIToUTF16("welcome")); } diff --git a/webkit/tools/test_shell/mock_spellcheck.h b/webkit/tools/test_shell/mock_spellcheck.h index 41b180d..8f7c395 100644 --- a/webkit/tools/test_shell/mock_spellcheck.h +++ b/webkit/tools/test_shell/mock_spellcheck.h @@ -29,14 +29,14 @@ class MockSpellCheck { // the first invalid word to misspelledLength, respectively. // For example, when the given text is " zz zz", this function sets 3 to // misspelledOffset and 2 to misspelledLength, respectively. - bool SpellCheckWord(const string16& text, + bool SpellCheckWord(const base::string16& text, int* misspelledOffset, int* misspelledLength); // Emulates suggestions for misspelled words. // The suggestions are pushed to |suggestions| parameters. - void FillSuggestions(const string16& word, - std::vector<string16>* suggestions); + void FillSuggestions(const base::string16& word, + std::vector<base::string16>* suggestions); private: // Initialize the internal resources if we need to initialize it. // Initializing this object may take long time. To prevent from hurting @@ -48,7 +48,7 @@ class MockSpellCheck { bool InitializeIfNeeded(); // A table that consists of misspelled words. - std::map<string16, bool> misspelled_words_; + std::map<base::string16, bool> misspelled_words_; // A flag representing whether or not this object is initialized. bool initialized_; diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.cc b/webkit/tools/test_shell/mock_webclipboard_impl.cc index c9c7648..9224b30 100644 --- a/webkit/tools/test_shell/mock_webclipboard_impl.cc +++ b/webkit/tools/test_shell/mock_webclipboard_impl.cc @@ -74,7 +74,8 @@ WebVector<WebString> MockWebClipboardImpl::readAvailableTypes( if (!m_image.isNull()) { results.push_back(WebString("image/png")); } - for (std::map<string16, string16>::const_iterator it = m_customData.begin(); + for (std::map<base::string16, base::string16>::const_iterator it = + m_customData.begin(); it != m_customData.end(); ++it) { CHECK(std::find(results.begin(), results.end(), it->first) == results.end()); @@ -127,7 +128,8 @@ WebKit::WebData MockWebClipboardImpl::readImage( WebKit::WebString MockWebClipboardImpl::readCustomData( WebKit::WebClipboard::Buffer buffer, const WebKit::WebString& type) { - std::map<string16, string16>::const_iterator it = m_customData.find(type); + std::map<base::string16, base::string16>::const_iterator it = + m_customData.find(type); if (it != m_customData.end()) return it->second; return WebKit::WebString(); diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.h b/webkit/tools/test_shell/mock_webclipboard_impl.h index b4c3577..3f3c5a6 100644 --- a/webkit/tools/test_shell/mock_webclipboard_impl.h +++ b/webkit/tools/test_shell/mock_webclipboard_impl.h @@ -53,7 +53,7 @@ class MockWebClipboardImpl : public WebKit::WebClipboard { WebKit::WebString m_plainText; WebKit::WebString m_htmlText; WebKit::WebImage m_image; - std::map<string16, string16> m_customData; + std::map<base::string16, base::string16> m_customData; bool m_writeSmartPaste; }; diff --git a/webkit/tools/test_shell/simple_clipboard_impl.cc b/webkit/tools/test_shell/simple_clipboard_impl.cc index 995624d..4e63b8ab 100644 --- a/webkit/tools/test_shell/simple_clipboard_impl.cc +++ b/webkit/tools/test_shell/simple_clipboard_impl.cc @@ -46,15 +46,15 @@ void SimpleClipboardClient::Clear(ui::Clipboard::Buffer buffer) { GetClipboard()->Clear(buffer); } -void SimpleClipboardClient::ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, - bool* contains_filenames) { - return GetClipboard()->ReadAvailableTypes(buffer, types, - contains_filenames); +void SimpleClipboardClient::ReadAvailableTypes( + ui::Clipboard::Buffer buffer, + std::vector<base::string16>* types, + bool* contains_filenames) { + return GetClipboard()->ReadAvailableTypes(buffer, types, contains_filenames); } void SimpleClipboardClient::ReadText(ui::Clipboard::Buffer buffer, - string16* result) { + base::string16* result) { GetClipboard()->ReadText(buffer, result); } @@ -64,7 +64,7 @@ void SimpleClipboardClient::ReadAsciiText(ui::Clipboard::Buffer buffer, } void SimpleClipboardClient::ReadHTML(ui::Clipboard::Buffer buffer, - string16* markup, + base::string16* markup, GURL* url, uint32* fragment_start, uint32* fragment_end) { std::string url_str; @@ -102,8 +102,8 @@ void SimpleClipboardClient::ReadImage(ui::Clipboard::Buffer buffer, } void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, - const string16& type, - string16* data) { + const base::string16& type, + base::string16* data) { GetClipboard()->ReadCustomData(buffer, type, data); } diff --git a/webkit/tools/test_shell/simple_clipboard_impl.h b/webkit/tools/test_shell/simple_clipboard_impl.h index 98d8d5b..9a8b438 100644 --- a/webkit/tools/test_shell/simple_clipboard_impl.h +++ b/webkit/tools/test_shell/simple_clipboard_impl.h @@ -19,13 +19,13 @@ class SimpleClipboardClient : public webkit_glue::ClipboardClient { ui::Clipboard::Buffer buffer) OVERRIDE; virtual void Clear(ui::Clipboard::Buffer buffer) OVERRIDE; virtual void ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) OVERRIDE; virtual void ReadText(ui::Clipboard::Buffer buffer, - string16* result) OVERRIDE; + base::string16* result) OVERRIDE; virtual void ReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result) OVERRIDE; - virtual void ReadHTML(ui::Clipboard::Buffer buffer, string16* markup, + virtual void ReadHTML(ui::Clipboard::Buffer buffer, base::string16* markup, GURL* url, uint32* fragment_start, uint32* fragment_end) OVERRIDE; virtual void ReadRTF(ui::Clipboard::Buffer buffer, @@ -33,8 +33,8 @@ class SimpleClipboardClient : public webkit_glue::ClipboardClient { virtual void ReadImage(ui::Clipboard::Buffer buffer, std::string* data) OVERRIDE; virtual void ReadCustomData(ui::Clipboard::Buffer buffer, - const string16& type, - string16* data) OVERRIDE; + const base::string16& type, + base::string16* data) OVERRIDE; virtual void ReadData(const ui::Clipboard::FormatType& format, std::string* data) OVERRIDE; virtual WriteContext* CreateWriteContext() OVERRIDE; diff --git a/webkit/tools/test_shell/simple_dom_storage_system.cc b/webkit/tools/test_shell/simple_dom_storage_system.cc index 7f05b2a..05eb07ec 100644 --- a/webkit/tools/test_shell/simple_dom_storage_system.cc +++ b/webkit/tools/test_shell/simple_dom_storage_system.cc @@ -176,7 +176,7 @@ void SimpleDomStorageSystem::AreaImpl::removeItem( return; base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); - string16 notused; + base::string16 notused; Host()->RemoveAreaItem(connection_id_, key, pageUrl, ¬used); } @@ -222,8 +222,8 @@ WebStorageNamespace* SimpleDomStorageSystem::CreateSessionStorageNamespace() { void SimpleDomStorageSystem::OnDomStorageItemSet( const dom_storage::DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, const GURL& page_url) { DispatchDomStorageEvent(area, page_url, @@ -234,8 +234,8 @@ void SimpleDomStorageSystem::OnDomStorageItemSet( void SimpleDomStorageSystem::OnDomStorageItemRemoved( const dom_storage::DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url) { DispatchDomStorageEvent(area, page_url, NullableString16(key, false), diff --git a/webkit/tools/test_shell/simple_dom_storage_system.h b/webkit/tools/test_shell/simple_dom_storage_system.h index c0b386c..8f46542 100644 --- a/webkit/tools/test_shell/simple_dom_storage_system.h +++ b/webkit/tools/test_shell/simple_dom_storage_system.h @@ -47,14 +47,14 @@ class SimpleDomStorageSystem // calls into webkit/webcore to dispatch events. virtual void OnDomStorageItemSet( const dom_storage::DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, const GURL& page_url) OVERRIDE; virtual void OnDomStorageItemRemoved( const dom_storage::DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url) OVERRIDE; virtual void OnDomStorageAreaCleared( const dom_storage::DomStorageArea* area, diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 7b73660..b97f4fa 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -144,7 +144,7 @@ class TestShellNetworkDelegate : public net::NetworkDelegate { virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE {} virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE { + const base::string16& error) OVERRIDE { } virtual AuthRequiredResponse OnAuthRequired( net::URLRequest* request, diff --git a/webkit/tools/test_shell/test_navigation_controller.cc b/webkit/tools/test_shell/test_navigation_controller.cc index 344c80c..9d80f58 100644 --- a/webkit/tools/test_shell/test_navigation_controller.cc +++ b/webkit/tools/test_shell/test_navigation_controller.cc @@ -16,7 +16,7 @@ TestNavigationEntry::TestNavigationEntry() TestNavigationEntry::TestNavigationEntry(int page_id, const GURL& url, - const string16& target_frame) + const base::string16& target_frame) : page_id_(page_id), url_(url), target_frame_(target_frame) { diff --git a/webkit/tools/test_shell/test_navigation_controller.h b/webkit/tools/test_shell/test_navigation_controller.h index 17de056..d1edd6c 100644 --- a/webkit/tools/test_shell/test_navigation_controller.h +++ b/webkit/tools/test_shell/test_navigation_controller.h @@ -40,7 +40,7 @@ class TestNavigationEntry { TestNavigationEntry(); TestNavigationEntry(int page_id, const GURL& url, - const string16& target_frame); + const base::string16& target_frame); // Virtual to allow test_shell to extend the class. ~TestNavigationEntry(); @@ -61,7 +61,7 @@ class TestNavigationEntry { void SetPageID(int page_id) { page_id_ = page_id; } int32 GetPageID() const { return page_id_; } - const string16& GetTargetFrame() const { return target_frame_; } + const base::string16& GetTargetFrame() const { return target_frame_; } private: // Describes the current page that the tab represents. This is not relevant @@ -71,7 +71,7 @@ class TestNavigationEntry { GURL url_; std::string state_; - string16 target_frame_; + base::string16 target_frame_; DISALLOW_COPY_AND_ASSIGN(TestNavigationEntry); }; diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 8895e4f..dab36d5 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -415,7 +415,7 @@ void TestShell::Show(WebNavigationPolicy policy) { delegate_->show(policy); } -void TestShell::DumpBackForwardEntry(int index, string16* result) { +void TestShell::DumpBackForwardEntry(int index, base::string16* result) { int current_index = navigation_controller_->GetLastCommittedEntryIndex(); std::string content_state = @@ -429,7 +429,7 @@ void TestShell::DumpBackForwardEntry(int index, string16* result) { webkit_glue::DumpHistoryState(content_state, 8, index == current_index)); } -void TestShell::DumpBackForwardList(string16* result) { +void TestShell::DumpBackForwardList(base::string16* result) { result->append(ASCIIToUTF16( "\n============== Back Forward List ==============\n")); @@ -503,11 +503,11 @@ void TestShell::ResetTestController() { } void TestShell::LoadFile(const base::FilePath& file) { - LoadURLForFrame(net::FilePathToFileURL(file), string16()); + LoadURLForFrame(net::FilePathToFileURL(file), base::string16()); } void TestShell::LoadURL(const GURL& url) { - LoadURLForFrame(url, string16()); + LoadURLForFrame(url, base::string16()); } bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) { @@ -578,7 +578,7 @@ void TestShell::DumpRenderTree() { file_util::WriteFile(file_path, data.c_str(), data.length()); } -string16 TestShell::GetDocumentText() { +base::string16 TestShell::GetDocumentText() { return webkit_glue::DumpDocumentText(webView()->mainFrame()); } diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index c6394e9..129ef9d 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -152,13 +152,13 @@ public: void LoadFile(const base::FilePath& file); void LoadURL(const GURL& url); - void LoadURLForFrame(const GURL& url, const string16& frame_name); + void LoadURLForFrame(const GURL& url, const base::string16& frame_name); void GoBackOrForward(int offset); void Reload(); bool Navigate(const TestNavigationEntry& entry, bool reload); bool PromptForSaveFile(const wchar_t* prompt_title, base::FilePath* result); - string16 GetDocumentText(); + base::string16 GetDocumentText(); void DumpDocumentText(); void DumpRenderTree(); @@ -191,13 +191,13 @@ public: // Writes the back-forward list data for every open window into result. // Should call DumpBackForwardListOfWindow on each TestShell window. - static void DumpAllBackForwardLists(string16* result); + static void DumpAllBackForwardLists(base::string16* result); // Writes the single back-forward entry into result. - void DumpBackForwardEntry(int index, string16* result); + void DumpBackForwardEntry(int index, base::string16* result); // Writes the back-forward list data for this test shell into result. - void DumpBackForwardList(string16* result); + void DumpBackForwardList(base::string16* result); static void ResetWebPreferences(); diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 527d937..eedb4b4 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -478,7 +478,7 @@ void TestShell::ResizeSubViews() { // GTK manages layout for us so we do nothing. } -/* static */ void TestShell::DumpAllBackForwardLists(string16* result) { +/* static */ void TestShell::DumpAllBackForwardLists(base::string16* result) { result->clear(); for (WindowList::iterator iter = TestShell::windowList()->begin(); iter != TestShell::windowList()->end(); iter++) { @@ -491,7 +491,7 @@ void TestShell::ResizeSubViews() { } void TestShell::LoadURLForFrame(const GURL& url, - const string16& frame_name) { + const base::string16& frame_name) { if (!url.is_valid()) return; @@ -565,7 +565,7 @@ base::StringPiece TestShell::ResourceProvider(int key) { //----------------------------------------------------------------------------- -string16 TestShellWebKitInit::GetLocalizedString(int message_id) { +base::string16 TestShellWebKitInit::GetLocalizedString(int message_id) { return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); } diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index 27cf6a0..fb0f232 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -508,7 +508,7 @@ void TestShell::ResizeSubViews() { // handled by Cocoa for us } -/* static */ void TestShell::DumpAllBackForwardLists(string16* result) { +/* static */ void TestShell::DumpAllBackForwardLists(base::string16* result) { result->clear(); for (WindowList::iterator iter = TestShell::windowList()->begin(); iter != TestShell::windowList()->end(); iter++) { @@ -522,7 +522,7 @@ void TestShell::ResizeSubViews() { } void TestShell::LoadURLForFrame(const GURL& url, - const string16& frame_name) { + const base::string16& frame_name) { if (!url.is_valid()) return; @@ -596,20 +596,20 @@ base::StringPiece TestShell::ResourceProvider(int key) { //----------------------------------------------------------------------------- -string16 TestShellWebKitInit::GetLocalizedString(int message_id) { +base::string16 TestShellWebKitInit::GetLocalizedString(int message_id) { base::StringPiece res; if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { LOG(FATAL) << "failed to load webkit string with id " << message_id; } // Data packs hold strings as either UTF8 or UTF16. - string16 msg; + base::string16 msg; switch (g_resource_data_pack->GetTextEncodingType()) { case ui::DataPack::UTF8: msg = UTF8ToUTF16(res); break; case ui::DataPack::UTF16: - msg = string16(reinterpret_cast<const char16*>(res.data()), + msg = base::string16(reinterpret_cast<const char16*>(res.data()), res.length() / 2); break; case ui::DataPack::BINARY: diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h index 7f774c4..4030449 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.h +++ b/webkit/tools/test_shell/test_shell_webkit_init.h @@ -88,7 +88,7 @@ class TestShellWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D( const WebKit::WebGraphicsContext3D::Attributes& attributes); - virtual string16 GetLocalizedString(int message_id) OVERRIDE; + virtual base::string16 GetLocalizedString(int message_id) OVERRIDE; virtual base::StringPiece GetDataResource( int resource_id, ui::ScaleFactor scale_factor) OVERRIDE; diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index b9b1b31..49a0f47 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -178,7 +178,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode, const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); if (parsed_command_line.HasSwitch(test_shell::kCrashDumps)) { - string16 dir( + base::string16 dir( parsed_command_line.GetSwitchValueNative(test_shell::kCrashDumps)); if (parsed_command_line.HasSwitch(test_shell::kCrashDumpsFulldump)) { new google_breakpad::ExceptionHandler( @@ -233,7 +233,7 @@ ATOM TestShell::RegisterWindowClass() { return RegisterClassEx(&wcex); } -void TestShell::DumpAllBackForwardLists(string16* result) { +void TestShell::DumpAllBackForwardLists(base::string16* result) { result->clear(); for (WindowList::iterator iter = TestShell::windowList()->begin(); iter != TestShell::windowList()->end(); iter++) { @@ -258,7 +258,7 @@ std::string TestShell::RewriteLocalUrl(const std::string& url) { replace_url = replace_url.AppendASCII("third_party"); replace_url = replace_url.AppendASCII("WebKit"); replace_url = replace_url.AppendASCII("LayoutTests"); - string16 replace_url_str = replace_url.value(); + base::string16 replace_url_str = replace_url.value(); replace_url_str.push_back(L'/'); new_url = std::string("file:///") + UTF16ToUTF8(replace_url_str).append(url.substr(kPrefixLen)); @@ -486,7 +486,7 @@ void TestShell::ResizeSubViews() { } void TestShell::LoadURLForFrame(const GURL& url, - const string16& frame_name) { + const base::string16& frame_name) { if (!url.is_valid()) return; @@ -669,7 +669,7 @@ base::StringPiece TestShell::ResourceProvider(int key) { } -string16 TestShellWebKitInit::GetLocalizedString(int message_id) { +base::string16 TestShellWebKitInit::GetLocalizedString(int message_id) { wchar_t localized[MAX_LOADSTRING]; int length = LoadString(GetModuleHandle(NULL), message_id, localized, MAX_LOADSTRING); @@ -677,7 +677,7 @@ string16 TestShellWebKitInit::GetLocalizedString(int message_id) { NOTREACHED(); return L"No string for this identifier!"; } - return string16(localized, length); + return base::string16(localized, length); } // TODO(tc): Convert this to using resources from test_shell.rc. diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 6fa3a97..76945f3 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -331,7 +331,7 @@ void TestWebViewDelegate::spellCheck(const WebString& text, // Check the spelling of the given text. // TODO(hbono): rebaseline layout-test results of Windows and Linux so we // can enable this mock spellchecker on them. - string16 word(text); + base::string16 word(text); mock_spellcheck_.SpellCheckWord(word, &misspelledOffset, &misspelledLength); #endif } @@ -980,7 +980,7 @@ void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) { entry->SetContentState(webkit_glue::HistoryItemToString(history_item)); } -string16 TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { +base::string16 TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { std::string name = UTF16ToUTF8(webframe->uniqueName()); if (webframe == shell_->webView()->mainFrame()) { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 667cf5f..8d1e5fc 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -321,7 +321,7 @@ class TestWebViewDelegate : public WebKit::WebViewClient, private: // Called the title of the page changes. // Can be used to update the title of the window. - void SetPageTitle(const string16& title); + void SetPageTitle(const base::string16& title); // Called when the URL of the page changes. // Extracts the URL and forwards on to SetAddressBarURL(). @@ -334,7 +334,7 @@ class TestWebViewDelegate : public WebKit::WebViewClient, // Show a JavaScript alert as a popup message. // The caller should test whether we're in layout test mode and only // call this function when we really want a message to pop up. - void ShowJavaScriptAlert(const string16& message); + void ShowJavaScriptAlert(const base::string16& message); // In the Mac code, this is called to trigger the end of a test after the // page has finished loading. From here, we can generate the dump for the @@ -359,7 +359,7 @@ class TestWebViewDelegate : public WebKit::WebViewClient, void UpdateSelectionClipboard(bool is_empty_selection); // Get a string suitable for dumping a frame to the console. - string16 GetFrameDescription(WebKit::WebFrame* webframe); + base::string16 GetFrameDescription(WebKit::WebFrame* webframe); // Causes navigation actions just printout the intended navigation instead // of taking you to the page. This is used for cases like mailto, where you diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index ec72930..4ce4a22 100644 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -246,7 +246,7 @@ void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { // Private methods ------------------------------------------------------------ -void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { +void TestWebViewDelegate::ShowJavaScriptAlert(const base::string16& message) { GtkWidget* dialog = gtk_message_dialog_new( shell_->mainWnd(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str()); @@ -255,7 +255,7 @@ void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { gtk_widget_destroy(dialog); } -void TestWebViewDelegate::SetPageTitle(const string16& title) { +void TestWebViewDelegate::SetPageTitle(const base::string16& title) { gtk_window_set_title(GTK_WINDOW(shell_->mainWnd()), ("Test Shell - " + UTF16ToUTF8(title)).c_str()); } diff --git a/webkit/tools/test_shell/test_webview_delegate_mac.mm b/webkit/tools/test_shell/test_webview_delegate_mac.mm index 42f5a64..6f034878 100644 --- a/webkit/tools/test_shell/test_webview_delegate_mac.mm +++ b/webkit/tools/test_shell/test_webview_delegate_mac.mm @@ -261,7 +261,7 @@ void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { // Private methods ------------------------------------------------------------ -void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { +void TestWebViewDelegate::ShowJavaScriptAlert(const base::string16& message) { NSString *text = [NSString stringWithUTF8String:UTF16ToUTF8(message).c_str()]; NSAlert *alert = [NSAlert alertWithMessageText:@"JavaScript Alert" @@ -272,7 +272,7 @@ void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { [alert runModal]; } -void TestWebViewDelegate::SetPageTitle(const string16& title) { +void TestWebViewDelegate::SetPageTitle(const base::string16& title) { [[shell_->webViewHost()->view_handle() window] setTitle:[NSString stringWithUTF8String:UTF16ToUTF8(title).c_str()]]; } diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc index c811f0e..6dd8a42 100644 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -192,16 +192,16 @@ void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { // Private methods ------------------------------------------------------------ -void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { +void TestWebViewDelegate::ShowJavaScriptAlert(const base::string16& message) { MessageBox(NULL, message.c_str(), L"JavaScript Alert", MB_OK); } -void TestWebViewDelegate::SetPageTitle(const string16& title) { +void TestWebViewDelegate::SetPageTitle(const base::string16& title) { // The Windows test shell, pre-refactoring, ignored this. *shrug* } void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { - string16 url_string = UTF8ToUTF16(url.spec()); + base::string16 url_string = UTF8ToUTF16(url.spec()); SendMessage(shell_->editWnd(), WM_SETTEXT, 0, reinterpret_cast<LPARAM>(url_string.c_str())); } |