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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const GURL& origin_url, | 113 const GURL& origin_url, |
114 StorageType type, | 114 StorageType type, |
115 std::unique_ptr<Callback> callback) { | 115 std::unique_ptr<Callback> callback) { |
116 DCHECK(callback); | 116 DCHECK(callback); |
117 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId()); | 117 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId()); |
118 pending_quota_callbacks_.AddWithID(std::move(callback), request_id); | 118 pending_quota_callbacks_.AddWithID(std::move(callback), request_id); |
119 thread_safe_sender_->Send(new QuotaHostMsg_QueryStorageUsageAndQuota( | 119 thread_safe_sender_->Send(new QuotaHostMsg_QueryStorageUsageAndQuota( |
120 request_id, origin_url, type)); | 120 request_id, origin_url, type)); |
121 } | 121 } |
122 | 122 |
123 void QuotaDispatcher::RequestStorageQuota(int render_view_id, | 123 void QuotaDispatcher::RequestStorageQuota(int render_frame_id, |
124 const GURL& origin_url, | 124 const GURL& origin_url, |
125 StorageType type, | 125 StorageType type, |
126 uint64_t requested_size, | 126 uint64_t requested_size, |
127 std::unique_ptr<Callback> callback) { | 127 std::unique_ptr<Callback> callback) { |
128 DCHECK(callback); | 128 DCHECK(callback); |
129 DCHECK(CurrentWorkerId() == 0); | 129 DCHECK(CurrentWorkerId() == 0); |
130 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId()); | 130 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId()); |
131 pending_quota_callbacks_.AddWithID(std::move(callback), request_id); | 131 pending_quota_callbacks_.AddWithID(std::move(callback), request_id); |
132 | 132 |
133 StorageQuotaParams params; | 133 StorageQuotaParams params; |
134 params.render_view_id = render_view_id; | 134 params.render_frame_id = render_frame_id; |
135 params.request_id = request_id; | 135 params.request_id = request_id; |
136 params.origin_url = origin_url; | 136 params.origin_url = origin_url; |
137 params.storage_type = type; | 137 params.storage_type = type; |
138 params.requested_size = requested_size; | 138 params.requested_size = requested_size; |
139 params.user_gesture = | 139 params.user_gesture = |
140 blink::WebUserGestureIndicator::isProcessingUserGesture(); | 140 blink::WebUserGestureIndicator::isProcessingUserGesture(); |
141 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(params)); | 141 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(params)); |
142 } | 142 } |
143 | 143 |
144 // static | 144 // static |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 "mismatching enums: kStorageTypePersistent"); | 183 "mismatching enums: kStorageTypePersistent"); |
184 | 184 |
185 static_assert(int(blink::WebStorageQuotaErrorNotSupported) == | 185 static_assert(int(blink::WebStorageQuotaErrorNotSupported) == |
186 int(storage::kQuotaErrorNotSupported), | 186 int(storage::kQuotaErrorNotSupported), |
187 "mismatching enums: kQuotaErrorNotSupported"); | 187 "mismatching enums: kQuotaErrorNotSupported"); |
188 static_assert(int(blink::WebStorageQuotaErrorAbort) == | 188 static_assert(int(blink::WebStorageQuotaErrorAbort) == |
189 int(storage::kQuotaErrorAbort), | 189 int(storage::kQuotaErrorAbort), |
190 "mismatching enums: kQuotaErrorAbort"); | 190 "mismatching enums: kQuotaErrorAbort"); |
191 | 191 |
192 } // namespace content | 192 } // namespace content |
OLD | NEW |