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

Side by Side Diff: content/renderer/dom_storage/webstoragearea_impl.cc

Issue 2600383002: Use explicit WebString <-> string16 conversion methods in storage API files (2) (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/dom_storage/webstoragearea_impl.h" 5 #include "content/renderer/dom_storage/webstoragearea_impl.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 g_all_areas_map.Pointer()->Remove(connection_id_); 44 g_all_areas_map.Pointer()->Remove(connection_id_);
45 if (dispatcher()) 45 if (dispatcher())
46 dispatcher()->CloseCachedArea(connection_id_, cached_area_.get()); 46 dispatcher()->CloseCachedArea(connection_id_, cached_area_.get());
47 } 47 }
48 48
49 unsigned WebStorageAreaImpl::length() { 49 unsigned WebStorageAreaImpl::length() {
50 return cached_area_->GetLength(connection_id_); 50 return cached_area_->GetLength(connection_id_);
51 } 51 }
52 52
53 WebString WebStorageAreaImpl::key(unsigned index) { 53 WebString WebStorageAreaImpl::key(unsigned index) {
54 return cached_area_->GetKey(connection_id_, index); 54 return WebString::fromUTF16(cached_area_->GetKey(connection_id_, index));
55 } 55 }
56 56
57 WebString WebStorageAreaImpl::getItem(const WebString& key) { 57 WebString WebStorageAreaImpl::getItem(const WebString& key) {
58 return cached_area_->GetItem(connection_id_, key); 58 return WebString::fromUTF16(
59 cached_area_->GetItem(connection_id_, key.utf16()));
59 } 60 }
60 61
61 void WebStorageAreaImpl::setItem( 62 void WebStorageAreaImpl::setItem(
62 const WebString& key, const WebString& value, const WebURL& page_url, 63 const WebString& key, const WebString& value, const WebURL& page_url,
63 WebStorageArea::Result& result) { 64 WebStorageArea::Result& result) {
64 if (!cached_area_->SetItem(connection_id_, key, value, page_url)) 65 if (!cached_area_->SetItem(connection_id_, key.utf16(), value.utf16(),
66 page_url))
65 result = ResultBlockedByQuota; 67 result = ResultBlockedByQuota;
66 else 68 else
67 result = ResultOK; 69 result = ResultOK;
68 } 70 }
69 71
70 void WebStorageAreaImpl::removeItem( 72 void WebStorageAreaImpl::removeItem(
71 const WebString& key, const WebURL& page_url) { 73 const WebString& key, const WebURL& page_url) {
72 cached_area_->RemoveItem(connection_id_, key, page_url); 74 cached_area_->RemoveItem(connection_id_, key.utf16(), page_url);
73 } 75 }
74 76
75 void WebStorageAreaImpl::clear(const WebURL& page_url) { 77 void WebStorageAreaImpl::clear(const WebURL& page_url) {
76 cached_area_->Clear(connection_id_, page_url); 78 cached_area_->Clear(connection_id_, page_url);
77 } 79 }
78 80
79 } // namespace content 81 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698