diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 13:47:46 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 13:47:46 +0000 |
commit | 0238a162e012a8dc22d8eb58a05d25eaf8f47bec (patch) | |
tree | 94417c59c8732eb85e12c621af6b0af0ffbfd32e | |
parent | 5bdc67b9478ad7bce05dc829c87852f8506dbf3d (diff) | |
download | chromium_src-0238a162e012a8dc22d8eb58a05d25eaf8f47bec.zip chromium_src-0238a162e012a8dc22d8eb58a05d25eaf8f47bec.tar.gz chromium_src-0238a162e012a8dc22d8eb58a05d25eaf8f47bec.tar.bz2 |
Move nullable_string16.h to the string subdirectory.
BUG=247723
TEST=no change
TBR=brettw@chromium.org
Review URL: https://codereview.chromium.org/16415016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206066 0039d316-1c4b-4281-b951-d872f2087c98
37 files changed, 244 insertions, 213 deletions
diff --git a/base/nullable_string16.h b/base/nullable_string16.h index dbcd37c..3adae7a 100644 --- a/base/nullable_string16.h +++ b/base/nullable_string16.h @@ -2,28 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_NULLABLE_STRING16_H_ -#define BASE_NULLABLE_STRING16_H_ - -#include "base/strings/string16.h" - -// This class is a simple wrapper for string16 which also contains a null -// state. This should be used only where the difference between null and -// empty is meaningful. -class NullableString16 { - public: - NullableString16() : is_null_(false) { } - explicit NullableString16(bool is_null) : is_null_(is_null) { } - NullableString16(const string16& string, bool is_null) - : string_(string), is_null_(is_null) { - } - - const string16& string() const { return string_; } - bool is_null() const { return is_null_; } - - private: - string16 string_; - bool is_null_; -}; - -#endif // BASE_NULLABLE_STRING16_H_ +// This file has moved, please use the new location. +// TODO(avi) remove this file when all users have been updated. +#include "base/strings/nullable_string16.h" diff --git a/base/strings/nullable_string16.h b/base/strings/nullable_string16.h new file mode 100644 index 0000000..73fe81e --- /dev/null +++ b/base/strings/nullable_string16.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_STRINGS_NULLABLE_STRING16_H_ +#define BASE_STRINGS_NULLABLE_STRING16_H_ + +#include "base/strings/string16.h" + +namespace base { + +// This class is a simple wrapper for string16 which also contains a null +// state. This should be used only where the difference between null and +// empty is meaningful. +class NullableString16 { + public: + NullableString16() : is_null_(false) { } + explicit NullableString16(bool is_null) : is_null_(is_null) { } + NullableString16(const string16& string, bool is_null) + : string_(string), is_null_(is_null) { + } + + const string16& string() const { return string_; } + bool is_null() const { return is_null_; } + + private: + string16 string_; + bool is_null_; +}; + +} // namespace + +// TODO(avi) update users of NullableString16 to use the namespace and remove +// this "using". +using base::NullableString16; + +#endif // BASE_STRINGS_NULLABLE_STRING16_H_ diff --git a/content/browser/dom_storage/dom_storage_message_filter.cc b/content/browser/dom_storage/dom_storage_message_filter.cc index 9d47cb7..0a67dd0 100644 --- a/content/browser/dom_storage/dom_storage_message_filter.cc +++ b/content/browser/dom_storage/dom_storage_message_filter.cc @@ -6,7 +6,7 @@ #include "base/auto_reset.h" #include "base/bind.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/sequenced_worker_pool.h" #include "content/browser/dom_storage/dom_storage_context_impl.h" @@ -122,7 +122,7 @@ void DOMStorageMessageFilter::OnSetItem( DCHECK_EQ(0, connection_dispatching_message_for_); base::AutoReset<int> auto_reset(&connection_dispatching_message_for_, connection_id); - NullableString16 not_used; + base::NullableString16 not_used; bool success = host_->SetAreaItem(connection_id, key, value, page_url, ¬_used); Send(new DOMStorageMsg_AsyncOperationComplete(success)); @@ -158,11 +158,11 @@ void DOMStorageMessageFilter::OnDomStorageItemSet( const dom_storage::DomStorageArea* area, const string16& key, const string16& new_value, - const NullableString16& old_value, + const base::NullableString16& old_value, const GURL& page_url) { SendDomStorageEvent(area, page_url, - NullableString16(key, false), - NullableString16(new_value, false), + base::NullableString16(key, false), + base::NullableString16(new_value, false), old_value); } @@ -172,26 +172,26 @@ void DOMStorageMessageFilter::OnDomStorageItemRemoved( const string16& old_value, const GURL& page_url) { SendDomStorageEvent(area, page_url, - NullableString16(key, false), - NullableString16(true), - NullableString16(old_value, false)); + base::NullableString16(key, false), + base::NullableString16(true), + base::NullableString16(old_value, false)); } void DOMStorageMessageFilter::OnDomStorageAreaCleared( const dom_storage::DomStorageArea* area, const GURL& page_url) { SendDomStorageEvent(area, page_url, - NullableString16(true), - NullableString16(true), - NullableString16(true)); + base::NullableString16(true), + base::NullableString16(true), + base::NullableString16(true)); } void DOMStorageMessageFilter::SendDomStorageEvent( const dom_storage::DomStorageArea* area, const GURL& page_url, - const NullableString16& key, - const NullableString16& new_value, - const NullableString16& old_value) { + const base::NullableString16& key, + const base::NullableString16& new_value, + const base::NullableString16& old_value) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); // Only send mutation events to processes which have the area open. bool originated_in_process = connection_dispatching_message_for_ != 0; diff --git a/content/browser/dom_storage/dom_storage_message_filter.h b/content/browser/dom_storage/dom_storage_message_filter.h index 9bee6d84..cc6ec352 100644 --- a/content/browser/dom_storage/dom_storage_message_filter.h +++ b/content/browser/dom_storage/dom_storage_message_filter.h @@ -12,7 +12,10 @@ #include "webkit/common/dom_storage/dom_storage_types.h" class GURL; + +namespace base { class NullableString16; +} namespace dom_storage { class DomStorageArea; @@ -63,7 +66,7 @@ class DOMStorageMessageFilter const dom_storage::DomStorageArea* area, const string16& key, const string16& new_value, - const NullableString16& old_value, + const base::NullableString16& old_value, const GURL& page_url) OVERRIDE; virtual void OnDomStorageItemRemoved( const dom_storage::DomStorageArea* area, @@ -77,9 +80,9 @@ class DOMStorageMessageFilter void SendDomStorageEvent( const dom_storage::DomStorageArea* area, const GURL& page_url, - const NullableString16& key, - const NullableString16& new_value, - const NullableString16& old_value); + const base::NullableString16& key, + const base::NullableString16& new_value, + const base::NullableString16& old_value); scoped_refptr<dom_storage::DomStorageContext> context_; scoped_ptr<dom_storage::DomStorageHost> host_; diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index dedc81c..20a1ef6 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -262,7 +262,7 @@ void PrepareWebDropData(WebDropData* drop_data, string16 plain_text; data.GetString(&plain_text); if (!plain_text.empty()) - drop_data->text = NullableString16(plain_text, false); + drop_data->text = base::NullableString16(plain_text, false); GURL url; string16 url_title; @@ -276,7 +276,7 @@ void PrepareWebDropData(WebDropData* drop_data, GURL html_base_url; data.GetHtml(&html, &html_base_url); if (!html.empty()) - drop_data->html = NullableString16(html, false); + drop_data->html = base::NullableString16(html, false); if (html_base_url.is_valid()) drop_data->html_base_url = html_base_url; diff --git a/content/browser/web_contents/web_drag_dest_gtk.cc b/content/browser/web_contents/web_drag_dest_gtk.cc index d34526e..ef63ba9 100644 --- a/content/browser/web_contents/web_drag_dest_gtk.cc +++ b/content/browser/web_contents/web_drag_dest_gtk.cc @@ -185,7 +185,7 @@ void WebDragDestGtk::OnDragDataReceived( if (target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) { guchar* text = gtk_selection_data_get_text(data); if (text) { - drop_data_->text = NullableString16( + drop_data_->text = base::NullableString16( UTF8ToUTF16(std::string(reinterpret_cast<const char*>(text))), false); g_free(text); @@ -209,7 +209,7 @@ void WebDragDestGtk::OnDragDataReceived( // This is a hack. Some file managers also populate text/plain with // a file URL when dragging files, so we clear it to avoid exposing // it to the web content. - drop_data_->text = NullableString16(true); + drop_data_->text = base::NullableString16(true); } else if (!drop_data_->url.is_valid()) { // Also set the first non-file URL as the URL content for the drop. drop_data_->url = url; @@ -219,7 +219,7 @@ void WebDragDestGtk::OnDragDataReceived( } } else if (target == ui::GetAtomForTarget(ui::TEXT_HTML)) { // TODO(estade): Can the html have a non-UTF8 encoding? - drop_data_->html = NullableString16( + drop_data_->html = base::NullableString16( UTF8ToUTF16(std::string(reinterpret_cast<const char*>(raw_data), data_length)), false); diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm index b1dde18..096c139 100644 --- a/content/browser/web_contents/web_drag_dest_mac.mm +++ b/content/browser/web_contents/web_drag_dest_mac.mm @@ -261,7 +261,7 @@ int GetModifierFlags() { // Get plain text. if ([types containsObject:NSStringPboardType]) { - data->text = NullableString16( + data->text = base::NullableString16( base::SysNSStringToUTF16([pboard stringForType:NSStringPboardType]), false); } @@ -269,13 +269,13 @@ int GetModifierFlags() { // Get HTML. If there's no HTML, try RTF. if ([types containsObject:NSHTMLPboardType]) { NSString* html = [pboard stringForType:NSHTMLPboardType]; - data->html = NullableString16(base::SysNSStringToUTF16(html), false); + data->html = base::NullableString16(base::SysNSStringToUTF16(html), false); } else if ([types containsObject:ui::kChromeDragImageHTMLPboardType]) { NSString* html = [pboard stringForType:ui::kChromeDragImageHTMLPboardType]; - data->html = NullableString16(base::SysNSStringToUTF16(html), false); + data->html = base::NullableString16(base::SysNSStringToUTF16(html), false); } else if ([types containsObject:NSRTFPboardType]) { NSString* html = [pboard htmlFromRtf]; - data->html = NullableString16(base::SysNSStringToUTF16(html), false); + data->html = base::NullableString16(base::SysNSStringToUTF16(html), false); } // Get files. diff --git a/content/browser/web_contents/web_drag_dest_win.cc b/content/browser/web_contents/web_drag_dest_win.cc index 2e10183..4b02ab4 100644 --- a/content/browser/web_contents/web_drag_dest_win.cc +++ b/content/browser/web_contents/web_drag_dest_win.cc @@ -78,13 +78,13 @@ void PopulateWebDropData(IDataObject* data_object, WebDropData* drop_data) { base::string16 text; ui::ClipboardUtil::GetPlainText(data_object, &text); if (!text.empty()) { - drop_data->text = NullableString16(text, false); + drop_data->text = base::NullableString16(text, false); } base::string16 html; std::string html_base_url; ui::ClipboardUtil::GetHtml(data_object, &html, &html_base_url); if (!html.empty()) { - drop_data->html = NullableString16(html, false); + drop_data->html = base::NullableString16(html, false); } if (!html_base_url.empty()) { drop_data->html_base_url = GURL(html_base_url); diff --git a/content/child/indexed_db/indexed_db_dispatcher.h b/content/child/indexed_db/indexed_db_dispatcher.h index f8b2102..ee8f4dd 100644 --- a/content/child/indexed_db/indexed_db_dispatcher.h +++ b/content/child/indexed_db/indexed_db_dispatcher.h @@ -10,7 +10,7 @@ #include "base/gtest_prod_util.h" #include "base/id_map.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "content/common/content_export.h" #include "ipc/ipc_sync_message_filter.h" #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" diff --git a/content/common/dom_storage_messages.h b/content/common/dom_storage_messages.h index 73c508e..689c80b 100644 --- a/content/common/dom_storage_messages.h +++ b/content/common/dom_storage_messages.h @@ -15,13 +15,13 @@ // Signals a local storage event. IPC_STRUCT_BEGIN(DOMStorageMsg_Event_Params) // The key that generated the storage event. Null if clear() was called. - IPC_STRUCT_MEMBER(NullableString16, key) + IPC_STRUCT_MEMBER(base::NullableString16, key) // The old value of this key. Null on clear() or if it didn't have a value. - IPC_STRUCT_MEMBER(NullableString16, old_value) + IPC_STRUCT_MEMBER(base::NullableString16, old_value) // The new value of this key. Null on removeItem() or clear(). - IPC_STRUCT_MEMBER(NullableString16, new_value) + IPC_STRUCT_MEMBER(base::NullableString16, new_value) // The origin this is associated with. IPC_STRUCT_MEMBER(GURL, origin) diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc index 0cdc2b4ef..839f15b 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -7,7 +7,7 @@ #include "base/files/file_path.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/time.h" @@ -525,24 +525,27 @@ void ParamTraits<ListValue>::Log(const param_type& p, std::string* l) { l->append(json); } -void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) { +void ParamTraits<base::NullableString16>::Write(Message* m, + const param_type& p) { WriteParam(m, p.string()); WriteParam(m, p.is_null()); } -bool ParamTraits<NullableString16>::Read(const Message* m, PickleIterator* iter, - param_type* r) { +bool ParamTraits<base::NullableString16>::Read(const Message* m, + PickleIterator* iter, + param_type* r) { string16 string; if (!ReadParam(m, iter, &string)) return false; bool is_null; if (!ReadParam(m, iter, &is_null)) return false; - *r = NullableString16(string, is_null); + *r = base::NullableString16(string, is_null); return true; } -void ParamTraits<NullableString16>::Log(const param_type& p, std::string* l) { +void ParamTraits<base::NullableString16>::Log(const param_type& p, + std::string* l) { l->append("("); LogParam(p.string(), l); l->append(", "); diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index ac324e0..7fda943 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -45,12 +45,11 @@ #error "Please add the noinline property for your new compiler here." #endif -class NullableString16; - namespace base { class DictionaryValue; class FilePath; class ListValue; +class NullableString16; class Time; class TimeDelta; class TimeTicks; @@ -454,8 +453,8 @@ struct IPC_EXPORT ParamTraits<base::ListValue> { }; template <> -struct IPC_EXPORT ParamTraits<NullableString16> { - typedef NullableString16 param_type; +struct IPC_EXPORT ParamTraits<base::NullableString16> { + typedef base::NullableString16 param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, PickleIterator* iter, param_type* r); diff --git a/webkit/browser/dom_storage/dom_storage_area.cc b/webkit/browser/dom_storage/dom_storage_area.cc index 645fcb0..216c7a4 100644 --- a/webkit/browser/dom_storage/dom_storage_area.cc +++ b/webkit/browser/dom_storage/dom_storage_area.cc @@ -113,23 +113,23 @@ unsigned DomStorageArea::Length() { return map_->Length(); } -NullableString16 DomStorageArea::Key(unsigned index) { +base::NullableString16 DomStorageArea::Key(unsigned index) { if (is_shutdown_) - return NullableString16(true); + return base::NullableString16(true); InitialImportIfNeeded(); return map_->Key(index); } -NullableString16 DomStorageArea::GetItem(const base::string16& key) { +base::NullableString16 DomStorageArea::GetItem(const base::string16& key) { if (is_shutdown_) - return NullableString16(true); + return base::NullableString16(true); InitialImportIfNeeded(); return map_->GetItem(key); } bool DomStorageArea::SetItem(const base::string16& key, const base::string16& value, - NullableString16* old_value) { + base::NullableString16* old_value) { if (is_shutdown_) return false; InitialImportIfNeeded(); @@ -138,7 +138,7 @@ bool DomStorageArea::SetItem(const base::string16& key, bool success = map_->SetItem(key, value, old_value); if (success && backing_) { CommitBatch* commit_batch = CreateCommitBatchIfNeeded(); - commit_batch->changed_values[key] = NullableString16(value, false); + commit_batch->changed_values[key] = base::NullableString16(value, false); } return success; } @@ -153,7 +153,7 @@ bool DomStorageArea::RemoveItem(const base::string16& key, bool success = map_->RemoveItem(key, old_value); if (success && backing_) { CommitBatch* commit_batch = CreateCommitBatchIfNeeded(); - commit_batch->changed_values[key] = NullableString16(true); + commit_batch->changed_values[key] = base::NullableString16(true); } return success; } diff --git a/webkit/browser/dom_storage/dom_storage_area.h b/webkit/browser/dom_storage/dom_storage_area.h index b243abb..71a9d9a 100644 --- a/webkit/browser/dom_storage/dom_storage_area.h +++ b/webkit/browser/dom_storage/dom_storage_area.h @@ -9,7 +9,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "googleurl/src/gurl.h" #include "webkit/browser/webkit_storage_browser_export.h" @@ -52,10 +52,10 @@ class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageArea void ExtractValues(ValuesMap* map); unsigned Length(); - NullableString16 Key(unsigned index); - NullableString16 GetItem(const base::string16& key); + base::NullableString16 Key(unsigned index); + base::NullableString16 GetItem(const base::string16& key); bool SetItem(const base::string16& key, const base::string16& value, - NullableString16* old_value); + base::NullableString16* old_value); bool RemoveItem(const base::string16& key, base::string16* old_value); bool Clear(); void FastClear(); diff --git a/webkit/browser/dom_storage/dom_storage_area_unittest.cc b/webkit/browser/dom_storage/dom_storage_area_unittest.cc index eb2b786..d400076 100644 --- a/webkit/browser/dom_storage/dom_storage_area_unittest.cc +++ b/webkit/browser/dom_storage/dom_storage_area_unittest.cc @@ -46,7 +46,7 @@ class DomStorageAreaTest : public testing::Test { EXPECT_TRUE(area->HasUncommittedChanges()); // Make additional change and verify that a new commit batch // is created for that change. - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(area->SetItem(kKey2, kValue2, &old_value)); EXPECT_TRUE(area->commit_batch_.get()); EXPECT_EQ(1, area->commit_batches_in_flight_); @@ -75,7 +75,7 @@ TEST_F(DomStorageAreaTest, DomStorageAreaBasics) { scoped_refptr<DomStorageArea> area( new DomStorageArea(1, std::string(), kOrigin, NULL, NULL)); base::string16 old_value; - NullableString16 old_nullable_value; + base::NullableString16 old_nullable_value; scoped_refptr<DomStorageArea> copy; // We don't focus on the underlying DomStorageMap functionality @@ -147,7 +147,7 @@ TEST_F(DomStorageAreaTest, BackingDatabaseOpened) { EXPECT_EQ(NULL, area->backing_.get()); EXPECT_TRUE(area->is_initial_import_done_); - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value)); ASSERT_TRUE(old_value.is_null()); @@ -176,7 +176,7 @@ TEST_F(DomStorageAreaTest, BackingDatabaseOpened) { area->backing_.reset(new LocalStorageDatabaseAdapter()); // Need to write something to ensure that the database is created. - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value)); ASSERT_TRUE(old_value.is_null()); EXPECT_TRUE(area->is_initial_import_done_); @@ -219,7 +219,7 @@ TEST_F(DomStorageAreaTest, CommitTasks) { EXPECT_TRUE(area->is_initial_import_done_); ValuesMap values; - NullableString16 old_value; + base::NullableString16 old_value; // See that changes are batched up. EXPECT_FALSE(area->commit_batch_.get()); @@ -294,7 +294,7 @@ TEST_F(DomStorageAreaTest, CommitChangesAtShutdown) { new VerifyChangesCommittedDatabase()); ValuesMap values; - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value)); EXPECT_TRUE(area->HasUncommittedChanges()); area->backing_->ReadAllValues(&values); @@ -326,7 +326,7 @@ TEST_F(DomStorageAreaTest, DeleteOrigin) { EXPECT_FALSE(file_util::PathExists(db_file_path)); // Commit something in the database and then delete. - NullableString16 old_value; + base::NullableString16 old_value; area->SetItem(kKey, kValue, &old_value); base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(file_util::PathExists(db_file_path)); @@ -395,7 +395,7 @@ TEST_F(DomStorageAreaTest, PurgeMemory) { EXPECT_EQ(original_map, area->map_.get()); // Should not do anything when commits are pending. - NullableString16 old_value; + base::NullableString16 old_value; area->SetItem(kKey, kValue, &old_value); EXPECT_TRUE(area->is_initial_import_done_); EXPECT_TRUE(area->HasUncommittedChanges()); diff --git a/webkit/browser/dom_storage/dom_storage_context.cc b/webkit/browser/dom_storage/dom_storage_context.cc index 7b5da67..269d2ae 100644 --- a/webkit/browser/dom_storage/dom_storage_context.cc +++ b/webkit/browser/dom_storage/dom_storage_context.cc @@ -210,7 +210,7 @@ void DomStorageContext::NotifyItemSet( const DomStorageArea* area, const base::string16& key, const base::string16& new_value, - const NullableString16& old_value, + const base::NullableString16& old_value, const GURL& page_url) { FOR_EACH_OBSERVER( EventObserver, event_observers_, diff --git a/webkit/browser/dom_storage/dom_storage_context.h b/webkit/browser/dom_storage/dom_storage_context.h index 8bc972c..e4bd95e 100644 --- a/webkit/browser/dom_storage/dom_storage_context.h +++ b/webkit/browser/dom_storage/dom_storage_context.h @@ -19,10 +19,9 @@ #include "googleurl/src/gurl.h" #include "webkit/browser/webkit_storage_browser_export.h" -class NullableString16; - namespace base { class FilePath; +class NullableString16; class Time; } @@ -70,7 +69,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageContext const DomStorageArea* area, const base::string16& key, const base::string16& new_value, - const NullableString16& old_value, // may be null on initial insert + const base::NullableString16& old_value, // may be null on initial insert const GURL& page_url) = 0; virtual void OnDomStorageItemRemoved( const DomStorageArea* area, @@ -93,7 +92,9 @@ class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageContext // Returns the directory path for localStorage, or an empty directory, if // there is no backing on disk. - const base::FilePath& localstorage_directory() { return localstorage_directory_; } + const base::FilePath& localstorage_directory() { + return localstorage_directory_; + } // Returns the directory path for sessionStorage, or an empty directory, if // there is no backing on disk. @@ -133,7 +134,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageContext const DomStorageArea* area, const base::string16& key, const base::string16& new_value, - const NullableString16& old_value, + const base::NullableString16& old_value, const GURL& page_url); void NotifyItemRemoved( const DomStorageArea* area, diff --git a/webkit/browser/dom_storage/dom_storage_context_unittest.cc b/webkit/browser/dom_storage/dom_storage_context_unittest.cc index 88a1f77..0abc3b0 100644 --- a/webkit/browser/dom_storage/dom_storage_context_unittest.cc +++ b/webkit/browser/dom_storage/dom_storage_context_unittest.cc @@ -99,7 +99,7 @@ TEST_F(DomStorageContextTest, UsageInfo) { // Put some data into local storage and shutdown the context // to ensure data is written to disk. - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> OpenStorageArea(kOrigin)->SetItem(kKey, kValue, &old_value)); context_->Shutdown(); @@ -129,7 +129,7 @@ TEST_F(DomStorageContextTest, SessionOnly) { // Store data for a normal and a session-only origin and then // invoke Shutdown() which should delete data for session-only // origins. - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> OpenStorageArea(kOrigin)->SetItem(kKey, kValue, &old_value)); EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> @@ -148,7 +148,7 @@ TEST_F(DomStorageContextTest, SetForceKeepSessionState) { // Store data for a session-only origin, setup to save session data, then // shutdown. - NullableString16 old_value; + base::NullableString16 old_value; EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> OpenStorageArea(kSessionOnlyOrigin)->SetItem(kKey, kValue, &old_value)); context_->SetForceKeepSessionState(); // Should override clear behavior. @@ -207,7 +207,7 @@ TEST_F(DomStorageContextTest, DeleteSessionStorage) { DomStorageArea* area = dom_namespace->OpenStorageArea(kOrigin); const base::string16 kKey(ASCIIToUTF16("foo")); const base::string16 kValue(ASCIIToUTF16("bar")); - NullableString16 old_nullable_value; + base::NullableString16 old_nullable_value; area->SetItem(kKey, kValue, &old_nullable_value); dom_namespace->CloseStorageArea(area); @@ -225,7 +225,7 @@ TEST_F(DomStorageContextTest, DeleteSessionStorage) { kPersistentId); dom_namespace = context_->GetStorageNamespace(kSessionStorageNamespaceId); area = dom_namespace->OpenStorageArea(kOrigin); - NullableString16 read_value; + base::NullableString16 read_value; read_value = area->GetItem(kKey); EXPECT_EQ(kValue, read_value.string()); dom_namespace->CloseStorageArea(area); diff --git a/webkit/browser/dom_storage/dom_storage_database.cc b/webkit/browser/dom_storage/dom_storage_database.cc index fdfbb86..b316a88 100644 --- a/webkit/browser/dom_storage/dom_storage_database.cc +++ b/webkit/browser/dom_storage/dom_storage_database.cc @@ -78,7 +78,7 @@ void DomStorageDatabase::ReadAllValues(ValuesMap* result) { base::string16 key = statement.ColumnString16(0); base::string16 value; statement.ColumnBlobAsString16(1, &value); - (*result)[key] = NullableString16(value, false); + (*result)[key] = base::NullableString16(value, false); } known_to_be_empty_ = result->empty(); } @@ -109,7 +109,7 @@ bool DomStorageDatabase::CommitChanges(bool clear_all_first, for(; it != changes.end(); ++it) { sql::Statement statement; base::string16 key = it->first; - NullableString16 value = it->second; + base::NullableString16 value = it->second; if (value.is_null()) { statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, "DELETE FROM ItemTable WHERE key=?")); @@ -289,7 +289,7 @@ bool DomStorageDatabase::UpgradeVersion1To2() { ValuesMap values; while (statement.Step()) { base::string16 key = statement.ColumnString16(0); - NullableString16 value(statement.ColumnString16(1), false); + base::NullableString16 value(statement.ColumnString16(1), false); values[key] = value; } diff --git a/webkit/browser/dom_storage/dom_storage_database.h b/webkit/browser/dom_storage/dom_storage_database.h index 1e3b658..1f1d501 100644 --- a/webkit/browser/dom_storage/dom_storage_database.h +++ b/webkit/browser/dom_storage/dom_storage_database.h @@ -10,7 +10,7 @@ #include "base/files/file_path.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "sql/connection.h" #include "webkit/browser/webkit_storage_browser_export.h" diff --git a/webkit/browser/dom_storage/dom_storage_database_unittest.cc b/webkit/browser/dom_storage/dom_storage_database_unittest.cc index 3feed4000..f61b53b 100644 --- a/webkit/browser/dom_storage/dom_storage_database_unittest.cc +++ b/webkit/browser/dom_storage/dom_storage_database_unittest.cc @@ -73,8 +73,8 @@ void CheckValuesMatch(DomStorageDatabase* db, ValuesMap::const_iterator it = values_read.begin(); for (; it != values_read.end(); ++it) { base::string16 key = it->first; - NullableString16 value = it->second; - NullableString16 expected_value = expected.find(key)->second; + base::NullableString16 value = it->second; + base::NullableString16 expected_value = expected.find(key)->second; EXPECT_EQ(expected_value.string(), value.string()); EXPECT_EQ(expected_value.is_null(), value.is_null()); } @@ -87,11 +87,11 @@ void CreateMapWithValues(ValuesMap* values) { ASCIIToUTF16("date"), ASCIIToUTF16("empty") }; - NullableString16 kCannedValues[] = { - NullableString16(ASCIIToUTF16("123"), false), - NullableString16(ASCIIToUTF16("Google"), false), - NullableString16(ASCIIToUTF16("18-01-2012"), false), - NullableString16(base::string16(), false) + base::NullableString16 kCannedValues[] = { + base::NullableString16(ASCIIToUTF16("123"), false), + base::NullableString16(ASCIIToUTF16("Google"), false), + base::NullableString16(ASCIIToUTF16("18-01-2012"), false), + base::NullableString16(base::string16(), false) }; for (unsigned i = 0; i < sizeof(kCannedKeys) / sizeof(kCannedKeys[0]); i++) (*values)[kCannedKeys[i]] = kCannedValues[i]; @@ -110,7 +110,8 @@ TEST(DomStorageDatabaseTest, SimpleOpenAndClose) { TEST(DomStorageDatabaseTest, CloseEmptyDatabaseDeletesFile) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - base::FilePath file_name = temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); + base::FilePath file_name = + temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); ValuesMap storage; CreateMapWithValues(&storage); @@ -156,7 +157,7 @@ TEST(DomStorageDatabaseTest, CloseEmptyDatabaseDeletesFile) { ASSERT_TRUE(db.CommitChanges(false, storage)); ValuesMap::iterator it = storage.begin(); for (; it != storage.end(); ++it) - it->second = NullableString16(true); + it->second = base::NullableString16(true); ASSERT_TRUE(db.CommitChanges(false, storage)); } EXPECT_FALSE(file_util::PathExists(file_name)); @@ -167,7 +168,8 @@ TEST(DomStorageDatabaseTest, TestLazyOpenIsLazy) { // open a file that already exists when only invoking ReadAllValues. base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - base::FilePath file_name = temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); + base::FilePath file_name = + temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); DomStorageDatabase db(file_name); EXPECT_FALSE(db.IsOpen()); @@ -176,7 +178,8 @@ TEST(DomStorageDatabaseTest, TestLazyOpenIsLazy) { // Reading an empty db should not open the database. EXPECT_FALSE(db.IsOpen()); - values[ASCIIToUTF16("key")] = NullableString16(ASCIIToUTF16("value"), false); + values[ASCIIToUTF16("key")] = + base::NullableString16(ASCIIToUTF16("value"), false); db.CommitChanges(false, values); // Writing content should open the database. EXPECT_TRUE(db.IsOpen()); @@ -214,7 +217,8 @@ TEST(DomStorageDatabaseTest, TestLazyOpenUpgradesDatabase) { // early if the database is already open). base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - base::FilePath file_name = temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); + base::FilePath file_name = + temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); DomStorageDatabase db(file_name); db.db_.reset(new sql::Connection()); @@ -248,7 +252,7 @@ TEST(DomStorageDatabaseTest, WriteWithClear) { // Insert some values, clearing the database first. storage.clear(); storage[ASCIIToUTF16("another_key")] = - NullableString16(ASCIIToUTF16("test"), false); + base::NullableString16(ASCIIToUTF16("test"), false); ASSERT_TRUE(db.CommitChanges(true, storage)); CheckValuesMatch(&db, storage); @@ -260,7 +264,7 @@ TEST(DomStorageDatabaseTest, WriteWithClear) { TEST(DomStorageDatabaseTest, UpgradeFromV1ToV2WithData) { const base::string16 kCannedKey = ASCIIToUTF16("foo"); - const NullableString16 kCannedValue(ASCIIToUTF16("bar"), false); + const base::NullableString16 kCannedValue(ASCIIToUTF16("bar"), false); ValuesMap expected; expected[kCannedKey] = kCannedValue; @@ -282,7 +286,7 @@ TEST(DomStorageDatabaseTest, TestSimpleRemoveOneValue) { ASSERT_TRUE(db.LazyOpen(true)); const base::string16 kCannedKey = ASCIIToUTF16("test"); - const NullableString16 kCannedValue(ASCIIToUTF16("data"), false); + const base::NullableString16 kCannedValue(ASCIIToUTF16("data"), false); ValuesMap expected; expected[kCannedKey] = kCannedValue; @@ -293,7 +297,7 @@ TEST(DomStorageDatabaseTest, TestSimpleRemoveOneValue) { ValuesMap values; // A null string in the map should mean that that key gets // removed. - values[kCannedKey] = NullableString16(true); + values[kCannedKey] = base::NullableString16(true); EXPECT_TRUE(db.CommitChanges(false, values)); expected.clear(); @@ -334,7 +338,8 @@ TEST(DomStorageDatabaseTest, TestCanOpenFileThatIsNotADatabase) { // Write into the temporary file first. base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - base::FilePath file_name = temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); + base::FilePath file_name = + temp_dir.path().AppendASCII("TestDomStorageDatabase.db"); const char kData[] = "I am not a database."; file_util::WriteFile(file_name, kData, strlen(kData)); diff --git a/webkit/browser/dom_storage/dom_storage_host.cc b/webkit/browser/dom_storage/dom_storage_host.cc index 040cf3d..95d4d76 100644 --- a/webkit/browser/dom_storage/dom_storage_host.cc +++ b/webkit/browser/dom_storage/dom_storage_host.cc @@ -80,25 +80,26 @@ unsigned DomStorageHost::GetAreaLength(int connection_id) { return area->Length(); } -NullableString16 DomStorageHost::GetAreaKey(int connection_id, unsigned index) { +base::NullableString16 DomStorageHost::GetAreaKey(int connection_id, + unsigned index) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) - return NullableString16(true); + return base::NullableString16(true); return area->Key(index); } -NullableString16 DomStorageHost::GetAreaItem(int connection_id, - const base::string16& key) { +base::NullableString16 DomStorageHost::GetAreaItem(int connection_id, + const base::string16& key) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) - return NullableString16(true); + return base::NullableString16(true); return area->GetItem(key); } bool DomStorageHost::SetAreaItem( int connection_id, const base::string16& key, const base::string16& value, const GURL& page_url, - NullableString16* old_value) { + base::NullableString16* old_value) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) { // TODO(michaeln): Fix crbug/134003 and return false here. diff --git a/webkit/browser/dom_storage/dom_storage_host.h b/webkit/browser/dom_storage/dom_storage_host.h index 0454c66..31e1962 100644 --- a/webkit/browser/dom_storage/dom_storage_host.h +++ b/webkit/browser/dom_storage/dom_storage_host.h @@ -8,7 +8,7 @@ #include <map> #include "base/memory/ref_counted.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "webkit/browser/webkit_storage_browser_export.h" #include "webkit/common/dom_storage/dom_storage_types.h" @@ -37,11 +37,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageHost { void CloseStorageArea(int connection_id); 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 base::string16& key); + base::NullableString16 GetAreaKey(int connection_id, unsigned index); + base::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); + base::NullableString16* old_value); bool RemoveAreaItem(int connection_id, const base::string16& key, const GURL& page_url, base::string16* old_value); diff --git a/webkit/browser/dom_storage/session_storage_database.cc b/webkit/browser/dom_storage/session_storage_database.cc index 3645c27..ef187ad 100644 --- a/webkit/browser/dom_storage/session_storage_database.cc +++ b/webkit/browser/dom_storage/session_storage_database.cc @@ -523,14 +523,15 @@ bool SessionStorageDatabase::ReadMap(const std::string& map_id, // Key is of the form "map-<mapid>-<key>". base::string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length())); if (only_keys) { - (*result)[key16] = NullableString16(true); + (*result)[key16] = base::NullableString16(true); } else { // Convert the raw data stored in std::string (it->value()) to raw data // 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(base::string16(data_ptr, len), false); + (*result)[key16] = + base::NullableString16(base::string16(data_ptr, len), false); } } return true; @@ -541,7 +542,7 @@ void SessionStorageDatabase::WriteValuesToMap(const std::string& map_id, leveldb::WriteBatch* batch) { for (ValuesMap::const_iterator it = values.begin(); it != values.end(); ++it) { - NullableString16 value = it->second; + base::NullableString16 value = it->second; std::string key = MapKey(map_id, UTF16ToUTF8(it->first)); if (value.is_null()) { batch->Delete(key); diff --git a/webkit/browser/dom_storage/session_storage_database_unittest.cc b/webkit/browser/dom_storage/session_storage_database_unittest.cc index 9216793..4cbd947 100644 --- a/webkit/browser/dom_storage/session_storage_database_unittest.cc +++ b/webkit/browser/dom_storage/session_storage_database_unittest.cc @@ -71,11 +71,11 @@ class SessionStorageDatabaseTest : public testing::Test { const base::string16 kKey1; const base::string16 kKey2; const base::string16 kKey3; - const NullableString16 kValue1; - const NullableString16 kValue2; - const NullableString16 kValue3; - const NullableString16 kValue4; - const NullableString16 kValueNull; + const base::NullableString16 kValue1; + const base::NullableString16 kValue2; + const base::NullableString16 kValue3; + const base::NullableString16 kValue4; + const base::NullableString16 kValueNull; DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabaseTest); }; @@ -89,11 +89,11 @@ SessionStorageDatabaseTest::SessionStorageDatabaseTest() kKey1(ASCIIToUTF16("key1")), kKey2(ASCIIToUTF16("key2")), kKey3(ASCIIToUTF16("key3")), - kValue1(NullableString16(ASCIIToUTF16("value1"), false)), - kValue2(NullableString16(ASCIIToUTF16("value2"), false)), - kValue3(NullableString16(ASCIIToUTF16("value3"), false)), - kValue4(NullableString16(ASCIIToUTF16("value4"), false)), - kValueNull(NullableString16(true)) { } + kValue1(base::NullableString16(ASCIIToUTF16("value1"), false)), + kValue2(base::NullableString16(ASCIIToUTF16("value2"), false)), + kValue3(base::NullableString16(ASCIIToUTF16("value3"), false)), + kValue4(base::NullableString16(ASCIIToUTF16("value4"), false)), + kValueNull(base::NullableString16(true)) { } SessionStorageDatabaseTest::~SessionStorageDatabaseTest() { } @@ -330,8 +330,8 @@ void SessionStorageDatabaseTest::CompareValuesMaps( for (ValuesMap::const_iterator it = map1.begin(); it != map1.end(); ++it) { base::string16 key = it->first; ASSERT_TRUE(map2.find(key) != map2.end()); - NullableString16 val1 = it->second; - NullableString16 val2 = map2.find(key)->second; + base::NullableString16 val1 = it->second; + base::NullableString16 val2 = map2.find(key)->second; EXPECT_EQ(val2.is_null(), val1.is_null()); EXPECT_EQ(val2.string(), val1.string()); } @@ -700,7 +700,7 @@ TEST_F(SessionStorageDatabaseTest, WriteRawBytes) { ValuesMap changes; 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); + changes[kKey1] = base::NullableString16(string_with_raw_data, false); EXPECT_TRUE(db_->CommitAreaChanges(kNamespace1, kOrigin1, false, changes)); CheckDatabaseConsistency(); ValuesMap values; diff --git a/webkit/common/dom_storage/dom_storage_map.cc b/webkit/common/dom_storage/dom_storage_map.cc index 003a6d2..377d185 100644 --- a/webkit/common/dom_storage/dom_storage_map.cc +++ b/webkit/common/dom_storage/dom_storage_map.cc @@ -39,9 +39,9 @@ unsigned DomStorageMap::Length() const { return values_.size(); } -NullableString16 DomStorageMap::Key(unsigned index) { +base::NullableString16 DomStorageMap::Key(unsigned index) { if (index >= values_.size()) - return NullableString16(true); + return base::NullableString16(true); while (last_key_index_ != index) { if (last_key_index_ > index) { --key_iterator_; @@ -51,22 +51,22 @@ NullableString16 DomStorageMap::Key(unsigned index) { ++last_key_index_; } } - return NullableString16(key_iterator_->first, false); + return base::NullableString16(key_iterator_->first, false); } -NullableString16 DomStorageMap::GetItem(const base::string16& key) const { +base::NullableString16 DomStorageMap::GetItem(const base::string16& key) const { ValuesMap::const_iterator found = values_.find(key); if (found == values_.end()) - return NullableString16(true); + return base::NullableString16(true); return found->second; } bool DomStorageMap::SetItem( const base::string16& key, const base::string16& value, - NullableString16* old_value) { + base::NullableString16* old_value) { ValuesMap::const_iterator found = values_.find(key); if (found == values_.end()) - *old_value = NullableString16(true); + *old_value = base::NullableString16(true); else *old_value = found->second; @@ -80,7 +80,7 @@ bool DomStorageMap::SetItem( if (new_item_size > old_item_size && new_bytes_used > quota_) return false; - values_[key] = NullableString16(value, false); + values_[key] = base::NullableString16(value, false); ResetKeyIterator(); bytes_used_ = new_bytes_used; return true; diff --git a/webkit/common/dom_storage/dom_storage_map.h b/webkit/common/dom_storage/dom_storage_map.h index 8920e7f..69db984 100644 --- a/webkit/common/dom_storage/dom_storage_map.h +++ b/webkit/common/dom_storage/dom_storage_map.h @@ -8,7 +8,7 @@ #include <map> #include "base/memory/ref_counted.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "webkit/common/dom_storage/dom_storage_types.h" #include "webkit/common/webkit_storage_common_export.h" @@ -24,10 +24,10 @@ class WEBKIT_STORAGE_COMMON_EXPORT DomStorageMap explicit DomStorageMap(size_t quota); unsigned Length() const; - NullableString16 Key(unsigned index); - NullableString16 GetItem(const base::string16& key) const; + base::NullableString16 Key(unsigned index); + base::NullableString16 GetItem(const base::string16& key) const; bool SetItem(const base::string16& key, const base::string16& value, - NullableString16* old_value); + base::NullableString16* old_value); bool RemoveItem(const base::string16& key, base::string16* old_value); // Swaps this instances values_ with |map|. diff --git a/webkit/common/dom_storage/dom_storage_map_unittest.cc b/webkit/common/dom_storage/dom_storage_map_unittest.cc index 232b5e6..d634bce 100644 --- a/webkit/common/dom_storage/dom_storage_map_unittest.cc +++ b/webkit/common/dom_storage/dom_storage_map_unittest.cc @@ -23,7 +23,7 @@ TEST(DomStorageMapTest, DomStorageMapBasics) { scoped_refptr<DomStorageMap> map(new DomStorageMap(kQuota)); base::string16 old_value; - NullableString16 old_nullable_value; + base::NullableString16 old_nullable_value; ValuesMap swap; scoped_refptr<DomStorageMap> copy; @@ -92,7 +92,7 @@ TEST(DomStorageMapTest, EnforcesQuota) { const size_t kQuota = 50; base::string16 old_value; - NullableString16 old_nullable_value; + base::NullableString16 old_nullable_value; scoped_refptr<DomStorageMap> map(new DomStorageMap(kQuota)); EXPECT_TRUE(map->SetItem(kKey, kValue, &old_nullable_value)); @@ -107,8 +107,8 @@ TEST(DomStorageMapTest, EnforcesQuota) { // Verify that the SwapValues method does not do quota checking. ValuesMap swap; - swap[kKey] = NullableString16(kValue, false); - swap[kKey2] = NullableString16(kValue, false); + swap[kKey] = base::NullableString16(kValue, false); + swap[kKey2] = base::NullableString16(kValue, false); map->SwapValues(&swap); EXPECT_GT(map->bytes_used(), kQuota); diff --git a/webkit/common/dom_storage/dom_storage_types.h b/webkit/common/dom_storage/dom_storage_types.h index 6a198dd..597e8eb 100644 --- a/webkit/common/dom_storage/dom_storage_types.h +++ b/webkit/common/dom_storage/dom_storage_types.h @@ -8,7 +8,7 @@ #include <map> #include "base/basictypes.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "base/time.h" #include "googleurl/src/gurl.h" @@ -38,7 +38,7 @@ const int64 kMaxInMemoryAreas = 100; // Value to indicate an area that not be opened. const int kInvalidAreaId = -1; -typedef std::map<base::string16, NullableString16> ValuesMap; +typedef std::map<base::string16, base::NullableString16> ValuesMap; struct WEBKIT_STORAGE_COMMON_EXPORT LocalStorageUsageInfo { GURL origin; diff --git a/webkit/common/webdropdata.cc b/webkit/common/webdropdata.cc index e641364..0cc8b0f 100644 --- a/webkit/common/webdropdata.cc +++ b/webkit/common/webdropdata.cc @@ -32,15 +32,15 @@ WebDropData::FileInfo::FileInfo(const base::string16& path, WebDropData::WebDropData(const WebDragData& drag_data) : referrer_policy(WebKit::WebReferrerPolicyDefault), - text(NullableString16(true)), - html(NullableString16(true)) { + text(base::NullableString16(true)), + html(base::NullableString16(true)) { const WebVector<WebDragData::Item>& item_list = drag_data.items(); for (size_t i = 0; i < item_list.size(); ++i) { const WebDragData::Item& item = item_list[i]; switch (item.storageType) { case WebDragData::Item::StorageTypeString: { if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) { - text = NullableString16(item.stringData, false); + text = base::NullableString16(item.stringData, false); break; } if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeURIList)) { @@ -53,7 +53,7 @@ WebDropData::WebDropData(const WebDragData& drag_data) break; } if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeHTML)) { - html = NullableString16(item.stringData, false); + html = base::NullableString16(item.stringData, false); html_base_url = item.baseURL; break; } @@ -76,8 +76,8 @@ WebDropData::WebDropData(const WebDragData& drag_data) WebDropData::WebDropData() : referrer_policy(WebKit::WebReferrerPolicyDefault), - text(NullableString16(true)), - html(NullableString16(true)) { + text(base::NullableString16(true)), + html(base::NullableString16(true)) { } WebDropData::~WebDropData() { diff --git a/webkit/common/webdropdata.h b/webkit/common/webdropdata.h index 1e32f56..c36d918 100644 --- a/webkit/common/webdropdata.h +++ b/webkit/common/webdropdata.h @@ -13,7 +13,7 @@ #include <string> #include <vector> -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" @@ -62,12 +62,12 @@ struct WEBKIT_COMMON_EXPORT WebDropData { base::string16 filesystem_id; // User is dragging plain text into the webview. - NullableString16 text; + base::NullableString16 text; // User is dragging text/html into the webview (e.g., out of Firefox). // |html_base_url| is the URL that the html fragment is taken from (used to // resolve relative links). It's ok for |html_base_url| to be empty. - NullableString16 html; + base::NullableString16 html; GURL html_base_url; // User is dragging data from the webview (e.g., an image). diff --git a/webkit/renderer/dom_storage/dom_storage_cached_area.cc b/webkit/renderer/dom_storage/dom_storage_cached_area.cc index 8884fec..dd04b28 100644 --- a/webkit/renderer/dom_storage/dom_storage_cached_area.cc +++ b/webkit/renderer/dom_storage/dom_storage_cached_area.cc @@ -27,13 +27,13 @@ unsigned DomStorageCachedArea::GetLength(int connection_id) { return map_->Length(); } -NullableString16 DomStorageCachedArea::GetKey( +base::NullableString16 DomStorageCachedArea::GetKey( int connection_id, unsigned index) { PrimeIfNeeded(connection_id); return map_->Key(index); } -NullableString16 DomStorageCachedArea::GetItem( +base::NullableString16 DomStorageCachedArea::GetItem( int connection_id, const base::string16& key) { PrimeIfNeeded(connection_id); return map_->GetItem(key); @@ -48,7 +48,7 @@ bool DomStorageCachedArea::SetItem( return false; PrimeIfNeeded(connection_id); - NullableString16 unused; + base::NullableString16 unused; if (!map_->SetItem(key, value, &unused)) return false; @@ -90,7 +90,8 @@ void DomStorageCachedArea::Clear(int connection_id, const GURL& page_url) { } void DomStorageCachedArea::ApplyMutation( - const NullableString16& key, const NullableString16& new_value) { + const base::NullableString16& key, + const base::NullableString16& new_value) { if (!map_.get() || ignore_all_mutations_) return; @@ -104,9 +105,9 @@ void DomStorageCachedArea::ApplyMutation( std::map<base::string16, int>::iterator iter = ignore_key_mutations_.begin(); while (iter != ignore_key_mutations_.end()) { - NullableString16 value = old->GetItem(iter->first); + base::NullableString16 value = old->GetItem(iter->first); if (!value.is_null()) { - NullableString16 unused; + base::NullableString16 unused; map_->SetItem(iter->first, value.string(), &unused); } ++iter; @@ -128,7 +129,7 @@ void DomStorageCachedArea::ApplyMutation( // It's a set item event. // We turn off quota checking here to accomodate the over budget // allowance that's provided in the browser process. - NullableString16 unused; + base::NullableString16 unused; map_->set_quota(kint32max); map_->SetItem(key.string(), new_value.string(), &unused); map_->set_quota(dom_storage::kPerAreaQuota); diff --git a/webkit/renderer/dom_storage/dom_storage_cached_area.h b/webkit/renderer/dom_storage/dom_storage_cached_area.h index d8620ee..ef6b48d 100644 --- a/webkit/renderer/dom_storage/dom_storage_cached_area.h +++ b/webkit/renderer/dom_storage/dom_storage_cached_area.h @@ -9,7 +9,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "googleurl/src/gurl.h" #include "webkit/renderer/webkit_storage_renderer_export.h" @@ -34,8 +34,8 @@ class WEBKIT_STORAGE_RENDERER_EXPORT DomStorageCachedArea : const GURL& origin() const { return origin_; } unsigned GetLength(int connection_id); - NullableString16 GetKey(int connection_id, unsigned index); - NullableString16 GetItem(int connection_id, const base::string16& key); + base::NullableString16 GetKey(int connection_id, unsigned index); + base::NullableString16 GetItem(int connection_id, const base::string16& key); bool SetItem(int connection_id, const base::string16& key, const base::string16& value, @@ -44,8 +44,8 @@ class WEBKIT_STORAGE_RENDERER_EXPORT DomStorageCachedArea : const GURL& page_url); void Clear(int connection_id, const GURL& page_url); - void ApplyMutation(const NullableString16& key, - const NullableString16& new_value); + void ApplyMutation(const base::NullableString16& key, + const base::NullableString16& new_value); size_t MemoryBytesUsedByCache() const; diff --git a/webkit/renderer/dom_storage/dom_storage_cached_area_unittest.cc b/webkit/renderer/dom_storage/dom_storage_cached_area_unittest.cc index 418e805..c5eee32 100644 --- a/webkit/renderer/dom_storage/dom_storage_cached_area_unittest.cc +++ b/webkit/renderer/dom_storage/dom_storage_cached_area_unittest.cc @@ -156,8 +156,8 @@ TEST_F(DomStorageCachedAreaTest, Basics) { EXPECT_EQ(kNamespaceId, cached_area->namespace_id()); EXPECT_EQ(kOrigin, cached_area->origin()); EXPECT_FALSE(mock_proxy_->HasOneRef()); - cached_area->ApplyMutation(NullableString16(kKey, false), - NullableString16(kValue, false)); + cached_area->ApplyMutation(base::NullableString16(kKey, false), + base::NullableString16(kValue, false)); EXPECT_FALSE(IsPrimed(cached_area.get())); ResetAll(cached_area.get()); @@ -251,7 +251,8 @@ TEST_F(DomStorageCachedAreaTest, Setters) { // RemoveItem with something to remove, expect a call to load followed // by a call to remove. ResetAll(cached_area.get()); - mock_proxy_->load_area_return_values_[kKey] = NullableString16(kValue, false); + mock_proxy_->load_area_return_values_[kKey] = + base::NullableString16(kValue, false); EXPECT_FALSE(IsPrimed(cached_area.get())); cached_area->RemoveItem(kConnectionId, kKey, kPageUrl); EXPECT_TRUE(IsPrimed(cached_area.get())); @@ -272,8 +273,8 @@ TEST_F(DomStorageCachedAreaTest, MutationsAreIgnoredUntilLoadCompletion) { EXPECT_TRUE(IsIgnoringAllMutations(cached_area.get())); // Before load completion, the mutation should be ignored. - cached_area->ApplyMutation(NullableString16(kKey, false), - NullableString16(kValue, false)); + cached_area->ApplyMutation(base::NullableString16(kKey, false), + base::NullableString16(kValue, false)); EXPECT_TRUE(cached_area->GetItem(kConnectionId, kKey).is_null()); // Call the load completion callback. @@ -281,8 +282,8 @@ TEST_F(DomStorageCachedAreaTest, MutationsAreIgnoredUntilLoadCompletion) { EXPECT_FALSE(IsIgnoringAllMutations(cached_area.get())); // Verify that mutations are now applied. - cached_area->ApplyMutation(NullableString16(kKey, false), - NullableString16(kValue, false)); + cached_area->ApplyMutation(base::NullableString16(kKey, false), + base::NullableString16(kValue, false)); EXPECT_EQ(kValue, cached_area->GetItem(kConnectionId, kKey).string()); } @@ -318,8 +319,8 @@ TEST_F(DomStorageCachedAreaTest, KeyMutationsAreIgnoredUntilCompletion) { mock_proxy_->CompleteOnePendingCallback(true); // load completion EXPECT_FALSE(IsIgnoringAllMutations(cached_area.get())); EXPECT_TRUE(IsIgnoringKeyMutations(cached_area.get(), kKey)); - cached_area->ApplyMutation(NullableString16(kKey, false), - NullableString16(true)); + cached_area->ApplyMutation(base::NullableString16(kKey, false), + base::NullableString16(true)); EXPECT_EQ(kValue, cached_area->GetItem(kConnectionId, kKey).string()); mock_proxy_->CompleteOnePendingCallback(true); // set completion EXPECT_FALSE(IsIgnoringKeyMutations(cached_area.get(), kKey)); diff --git a/webkit/renderer/dom_storage/dom_storage_proxy.h b/webkit/renderer/dom_storage/dom_storage_proxy.h index 9b8e5be..81b18b1 100644 --- a/webkit/renderer/dom_storage/dom_storage_proxy.h +++ b/webkit/renderer/dom_storage/dom_storage_proxy.h @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/memory/ref_counted.h" -#include "base/nullable_string16.h" +#include "base/strings/nullable_string16.h" #include "base/strings/string16.h" #include "googleurl/src/gurl.h" #include "webkit/common/dom_storage/dom_storage_types.h" diff --git a/webkit/support/simple_dom_storage_system.cc b/webkit/support/simple_dom_storage_system.cc index 34762ac..b7eb545 100644 --- a/webkit/support/simple_dom_storage_system.cc +++ b/webkit/support/simple_dom_storage_system.cc @@ -145,13 +145,13 @@ unsigned SimpleDomStorageSystem::AreaImpl::length() { WebString SimpleDomStorageSystem::AreaImpl::key(unsigned index) { if (Host()) return Host()->GetAreaKey(connection_id_, index); - return NullableString16(true); + return base::NullableString16(true); } WebString SimpleDomStorageSystem::AreaImpl::getItem(const WebString& key) { if (Host()) return Host()->GetAreaItem(connection_id_, key); - return NullableString16(true); + return base::NullableString16(true); } void SimpleDomStorageSystem::AreaImpl::setItem( @@ -162,7 +162,7 @@ void SimpleDomStorageSystem::AreaImpl::setItem( return; base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); - NullableString16 unused; + base::NullableString16 unused; if (!Host()->SetAreaItem(connection_id_, key, newValue, pageUrl, &unused)) return; @@ -226,11 +226,11 @@ void SimpleDomStorageSystem::OnDomStorageItemSet( const dom_storage::DomStorageArea* area, const base::string16& key, const base::string16& new_value, - const NullableString16& old_value, + const base::NullableString16& old_value, const GURL& page_url) { DispatchDomStorageEvent(area, page_url, - NullableString16(key, false), - NullableString16(new_value, false), + base::NullableString16(key, false), + base::NullableString16(new_value, false), old_value); } @@ -240,26 +240,26 @@ void SimpleDomStorageSystem::OnDomStorageItemRemoved( const base::string16& old_value, const GURL& page_url) { DispatchDomStorageEvent(area, page_url, - NullableString16(key, false), - NullableString16(true), - NullableString16(old_value, false)); + base::NullableString16(key, false), + base::NullableString16(true), + base::NullableString16(old_value, false)); } void SimpleDomStorageSystem::OnDomStorageAreaCleared( const dom_storage::DomStorageArea* area, const GURL& page_url) { DispatchDomStorageEvent(area, page_url, - NullableString16(true), - NullableString16(true), - NullableString16(true)); + base::NullableString16(true), + base::NullableString16(true), + base::NullableString16(true)); } void SimpleDomStorageSystem::DispatchDomStorageEvent( const dom_storage::DomStorageArea* area, const GURL& page_url, - const NullableString16& key, - const NullableString16& new_value, - const NullableString16& old_value) { + const base::NullableString16& key, + const base::NullableString16& new_value, + const base::NullableString16& old_value) { DCHECK(area_being_processed_); if (area->namespace_id() == dom_storage::kLocalStorageNamespaceId) { WebStorageEventDispatcher::dispatchLocalStorageEvent( diff --git a/webkit/support/simple_dom_storage_system.h b/webkit/support/simple_dom_storage_system.h index 71824a9..11a1946 100644 --- a/webkit/support/simple_dom_storage_system.h +++ b/webkit/support/simple_dom_storage_system.h @@ -49,7 +49,7 @@ class SimpleDomStorageSystem const dom_storage::DomStorageArea* area, const base::string16& key, const base::string16& new_value, - const NullableString16& old_value, + const base::NullableString16& old_value, const GURL& page_url) OVERRIDE; virtual void OnDomStorageItemRemoved( const dom_storage::DomStorageArea* area, @@ -63,9 +63,9 @@ class SimpleDomStorageSystem void DispatchDomStorageEvent( const dom_storage::DomStorageArea* area, const GURL& page_url, - const NullableString16& key, - const NullableString16& new_value, - const NullableString16& old_value); + const base::NullableString16& key, + const base::NullableString16& new_value, + const base::NullableString16& old_value); base::WeakPtrFactory<SimpleDomStorageSystem> weak_factory_; scoped_refptr<dom_storage::DomStorageContext> context_; |