| OLD | NEW |
| 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/dom_storage_dispatcher.h" | 5 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DOMStorageCachedArea* LookupCachedArea( | 104 DOMStorageCachedArea* LookupCachedArea( |
| 105 int64 namespace_id, const GURL& origin); | 105 int64 namespace_id, const GURL& origin); |
| 106 void ResetAllCachedAreas(int64 namespace_id); | 106 void ResetAllCachedAreas(int64 namespace_id); |
| 107 void CompleteOnePendingCallback(bool success); | 107 void CompleteOnePendingCallback(bool success); |
| 108 void Shutdown(); | 108 void Shutdown(); |
| 109 | 109 |
| 110 // DOMStorageProxy interface for use by DOMStorageCachedArea. | 110 // DOMStorageProxy interface for use by DOMStorageCachedArea. |
| 111 virtual void LoadArea(int connection_id, DOMStorageValuesMap* values, | 111 virtual void LoadArea(int connection_id, DOMStorageValuesMap* values, |
| 112 bool* send_log_get_messages, | 112 bool* send_log_get_messages, |
| 113 const CompletionCallback& callback) OVERRIDE; | 113 const CompletionCallback& callback) OVERRIDE; |
| 114 virtual void SetItem(int connection_id, const string16& key, | 114 virtual void SetItem(int connection_id, const base::string16& key, |
| 115 const string16& value, const GURL& page_url, | 115 const base::string16& value, const GURL& page_url, |
| 116 const CompletionCallback& callback) OVERRIDE; | 116 const CompletionCallback& callback) OVERRIDE; |
| 117 virtual void LogGetItem(int connection_id, const string16& key, | 117 virtual void LogGetItem(int connection_id, const base::string16& key, |
| 118 const base::NullableString16& value) OVERRIDE; | 118 const base::NullableString16& value) OVERRIDE; |
| 119 virtual void RemoveItem(int connection_id, const string16& key, | 119 virtual void RemoveItem(int connection_id, const base::string16& key, |
| 120 const GURL& page_url, | 120 const GURL& page_url, |
| 121 const CompletionCallback& callback) OVERRIDE; | 121 const CompletionCallback& callback) OVERRIDE; |
| 122 virtual void ClearArea(int connection_id, | 122 virtual void ClearArea(int connection_id, |
| 123 const GURL& page_url, | 123 const GURL& page_url, |
| 124 const CompletionCallback& callback) OVERRIDE; | 124 const CompletionCallback& callback) OVERRIDE; |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 // Struct to hold references to our contained areas and | 127 // Struct to hold references to our contained areas and |
| 128 // to keep track of how many tabs have a given area open. | 128 // to keep track of how many tabs have a given area open. |
| 129 struct CachedAreaHolder { | 129 struct CachedAreaHolder { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 void DomStorageDispatcher::ProxyImpl::LoadArea( | 238 void DomStorageDispatcher::ProxyImpl::LoadArea( |
| 239 int connection_id, DOMStorageValuesMap* values, bool* send_log_get_messages, | 239 int connection_id, DOMStorageValuesMap* values, bool* send_log_get_messages, |
| 240 const CompletionCallback& callback) { | 240 const CompletionCallback& callback) { |
| 241 PushPendingCallback(callback); | 241 PushPendingCallback(callback); |
| 242 throttling_filter_->SendThrottled(new DOMStorageHostMsg_LoadStorageArea( | 242 throttling_filter_->SendThrottled(new DOMStorageHostMsg_LoadStorageArea( |
| 243 connection_id, values, send_log_get_messages)); | 243 connection_id, values, send_log_get_messages)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void DomStorageDispatcher::ProxyImpl::SetItem( | 246 void DomStorageDispatcher::ProxyImpl::SetItem( |
| 247 int connection_id, const string16& key, | 247 int connection_id, const base::string16& key, |
| 248 const string16& value, const GURL& page_url, | 248 const base::string16& value, const GURL& page_url, |
| 249 const CompletionCallback& callback) { | 249 const CompletionCallback& callback) { |
| 250 PushPendingCallback(callback); | 250 PushPendingCallback(callback); |
| 251 throttling_filter_->SendThrottled(new DOMStorageHostMsg_SetItem( | 251 throttling_filter_->SendThrottled(new DOMStorageHostMsg_SetItem( |
| 252 connection_id, key, value, page_url)); | 252 connection_id, key, value, page_url)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void DomStorageDispatcher::ProxyImpl::LogGetItem( | 255 void DomStorageDispatcher::ProxyImpl::LogGetItem( |
| 256 int connection_id, const string16& key, | 256 int connection_id, const base::string16& key, |
| 257 const base::NullableString16& value) { | 257 const base::NullableString16& value) { |
| 258 sender_->Send(new DOMStorageHostMsg_LogGetItem(connection_id, key, value)); | 258 sender_->Send(new DOMStorageHostMsg_LogGetItem(connection_id, key, value)); |
| 259 } | 259 } |
| 260 | 260 |
| 261 void DomStorageDispatcher::ProxyImpl::RemoveItem( | 261 void DomStorageDispatcher::ProxyImpl::RemoveItem( |
| 262 int connection_id, const string16& key, const GURL& page_url, | 262 int connection_id, const base::string16& key, const GURL& page_url, |
| 263 const CompletionCallback& callback) { | 263 const CompletionCallback& callback) { |
| 264 PushPendingCallback(callback); | 264 PushPendingCallback(callback); |
| 265 throttling_filter_->SendThrottled(new DOMStorageHostMsg_RemoveItem( | 265 throttling_filter_->SendThrottled(new DOMStorageHostMsg_RemoveItem( |
| 266 connection_id, key, page_url)); | 266 connection_id, key, page_url)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void DomStorageDispatcher::ProxyImpl::ClearArea(int connection_id, | 269 void DomStorageDispatcher::ProxyImpl::ClearArea(int connection_id, |
| 270 const GURL& page_url, | 270 const GURL& page_url, |
| 271 const CompletionCallback& callback) { | 271 const CompletionCallback& callback) { |
| 272 PushPendingCallback(callback); | 272 PushPendingCallback(callback); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { | 355 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { |
| 356 proxy_->CompleteOnePendingCallback(success); | 356 proxy_->CompleteOnePendingCallback(success); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void DomStorageDispatcher::OnResetCachedValues(int64 namespace_id) { | 359 void DomStorageDispatcher::OnResetCachedValues(int64 namespace_id) { |
| 360 proxy_->ResetAllCachedAreas(namespace_id); | 360 proxy_->ResetAllCachedAreas(namespace_id); |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace content | 363 } // namespace content |
| OLD | NEW |