| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/child/quota_dispatcher.h" | 5 #include "content/child/quota_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/threading/thread_local.h" | 9 #include "base/threading/thread_local.h" |
| 10 #include "content/child/child_thread.h" | 10 #include "content/child/child_thread.h" |
| 11 #include "content/child/quota_message_filter.h" | 11 #include "content/child/quota_message_filter.h" |
| 12 #include "content/child/thread_safe_sender.h" | 12 #include "content/child/thread_safe_sender.h" |
| 13 #include "content/common/quota_messages.h" | 13 #include "content/common/quota_messages.h" |
| 14 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 14 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
| 15 #include "third_party/WebKit/public/platform/WebStorageQuotaType.h" | 15 #include "third_party/WebKit/public/platform/WebStorageQuotaType.h" |
| 16 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 using blink::WebStorageQuotaCallbacks; | 19 using blink::WebStorageQuotaCallbacks; |
| 19 using blink::WebStorageQuotaError; | 20 using blink::WebStorageQuotaError; |
| 20 using blink::WebStorageQuotaType; | 21 using blink::WebStorageQuotaType; |
| 21 using quota::QuotaStatusCode; | 22 using quota::QuotaStatusCode; |
| 22 using quota::StorageType; | 23 using quota::StorageType; |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void QuotaDispatcher::RequestStorageQuota( | 120 void QuotaDispatcher::RequestStorageQuota( |
| 120 int render_view_id, | 121 int render_view_id, |
| 121 const GURL& origin_url, | 122 const GURL& origin_url, |
| 122 StorageType type, | 123 StorageType type, |
| 123 uint64 requested_size, | 124 uint64 requested_size, |
| 124 Callback* callback) { | 125 Callback* callback) { |
| 125 DCHECK(callback); | 126 DCHECK(callback); |
| 126 DCHECK(CurrentWorkerId() == 0); | 127 DCHECK(CurrentWorkerId() == 0); |
| 127 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId()); | 128 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId()); |
| 128 pending_quota_callbacks_.AddWithID(callback, request_id); | 129 pending_quota_callbacks_.AddWithID(callback, request_id); |
| 129 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota( | 130 |
| 130 render_view_id, request_id, origin_url, type, requested_size)); | 131 quota::RequestStorageQuotaParams params; |
| 132 params.render_view_id = render_view_id; |
| 133 params.request_id = request_id; |
| 134 params.origin_url = origin_url; |
| 135 params.storage_type = type; |
| 136 params.requested_size = requested_size; |
| 137 params.user_gesture = |
| 138 blink::WebUserGestureIndicator::isProcessingUserGesture(); |
| 139 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(params)); |
| 131 } | 140 } |
| 132 | 141 |
| 133 // static | 142 // static |
| 134 QuotaDispatcher::Callback* | 143 QuotaDispatcher::Callback* |
| 135 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper( | 144 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper( |
| 136 blink::WebStorageQuotaCallbacks callbacks) { | 145 blink::WebStorageQuotaCallbacks callbacks) { |
| 137 return new WebStorageQuotaDispatcherCallback(callbacks); | 146 return new WebStorageQuotaDispatcherCallback(callbacks); |
| 138 } | 147 } |
| 139 | 148 |
| 140 void QuotaDispatcher::DidGrantStorageQuota( | 149 void QuotaDispatcher::DidGrantStorageQuota( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 170 int(quota::kStorageTypeTemporary), mismatching_enums); | 179 int(quota::kStorageTypeTemporary), mismatching_enums); |
| 171 COMPILE_ASSERT(int(blink::WebStorageQuotaTypePersistent) == \ | 180 COMPILE_ASSERT(int(blink::WebStorageQuotaTypePersistent) == \ |
| 172 int(quota::kStorageTypePersistent), mismatching_enums); | 181 int(quota::kStorageTypePersistent), mismatching_enums); |
| 173 | 182 |
| 174 COMPILE_ASSERT(int(blink::WebStorageQuotaErrorNotSupported) == \ | 183 COMPILE_ASSERT(int(blink::WebStorageQuotaErrorNotSupported) == \ |
| 175 int(quota::kQuotaErrorNotSupported), mismatching_enums); | 184 int(quota::kQuotaErrorNotSupported), mismatching_enums); |
| 176 COMPILE_ASSERT(int(blink::WebStorageQuotaErrorAbort) == \ | 185 COMPILE_ASSERT(int(blink::WebStorageQuotaErrorAbort) == \ |
| 177 int(quota::kQuotaErrorAbort), mismatching_enums); | 186 int(quota::kQuotaErrorAbort), mismatching_enums); |
| 178 | 187 |
| 179 } // namespace content | 188 } // namespace content |
| OLD | NEW |