| 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/browser/renderer_host/quota_dispatcher_host.h" | 5 #include "content/browser/renderer_host/quota_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/common/quota_messages.h" | 9 #include "content/common/quota_messages.h" |
| 10 #include "content/public/browser/quota_permission_context.h" | 10 #include "content/public/browser/quota_permission_context.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 QuotaDispatcherHost::QuotaDispatcherHost( | 200 QuotaDispatcherHost::QuotaDispatcherHost( |
| 201 int process_id, | 201 int process_id, |
| 202 QuotaManager* quota_manager, | 202 QuotaManager* quota_manager, |
| 203 QuotaPermissionContext* permission_context) | 203 QuotaPermissionContext* permission_context) |
| 204 : process_id_(process_id), | 204 : process_id_(process_id), |
| 205 quota_manager_(quota_manager), | 205 quota_manager_(quota_manager), |
| 206 permission_context_(permission_context) { | 206 permission_context_(permission_context) { |
| 207 } | 207 } |
| 208 | 208 |
| 209 QuotaDispatcherHost::~QuotaDispatcherHost() { | |
| 210 } | |
| 211 | |
| 212 bool QuotaDispatcherHost::OnMessageReceived( | 209 bool QuotaDispatcherHost::OnMessageReceived( |
| 213 const IPC::Message& message, bool* message_was_ok) { | 210 const IPC::Message& message, bool* message_was_ok) { |
| 214 *message_was_ok = true; | 211 *message_was_ok = true; |
| 215 bool handled = true; | 212 bool handled = true; |
| 216 IPC_BEGIN_MESSAGE_MAP_EX(QuotaDispatcherHost, message, *message_was_ok) | 213 IPC_BEGIN_MESSAGE_MAP_EX(QuotaDispatcherHost, message, *message_was_ok) |
| 217 IPC_MESSAGE_HANDLER(QuotaHostMsg_QueryStorageUsageAndQuota, | 214 IPC_MESSAGE_HANDLER(QuotaHostMsg_QueryStorageUsageAndQuota, |
| 218 OnQueryStorageUsageAndQuota) | 215 OnQueryStorageUsageAndQuota) |
| 219 IPC_MESSAGE_HANDLER(QuotaHostMsg_RequestStorageQuota, | 216 IPC_MESSAGE_HANDLER(QuotaHostMsg_RequestStorageQuota, |
| 220 OnRequestStorageQuota) | 217 OnRequestStorageQuota) |
| 221 IPC_MESSAGE_UNHANDLED(handled = false) | 218 IPC_MESSAGE_UNHANDLED(handled = false) |
| 222 IPC_END_MESSAGE_MAP_EX() | 219 IPC_END_MESSAGE_MAP_EX() |
| 223 return handled; | 220 return handled; |
| 224 } | 221 } |
| 225 | 222 |
| 223 QuotaDispatcherHost::~QuotaDispatcherHost() {} |
| 224 |
| 226 void QuotaDispatcherHost::OnQueryStorageUsageAndQuota( | 225 void QuotaDispatcherHost::OnQueryStorageUsageAndQuota( |
| 227 int request_id, | 226 int request_id, |
| 228 const GURL& origin, | 227 const GURL& origin, |
| 229 StorageType type) { | 228 StorageType type) { |
| 230 QueryUsageAndQuotaDispatcher* dispatcher = new QueryUsageAndQuotaDispatcher( | 229 QueryUsageAndQuotaDispatcher* dispatcher = new QueryUsageAndQuotaDispatcher( |
| 231 this, request_id); | 230 this, request_id); |
| 232 dispatcher->QueryStorageUsageAndQuota(origin, type); | 231 dispatcher->QueryStorageUsageAndQuota(origin, type); |
| 233 } | 232 } |
| 234 | 233 |
| 235 void QuotaDispatcherHost::OnRequestStorageQuota( | 234 void QuotaDispatcherHost::OnRequestStorageQuota( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 248 type != quota::kStorageTypePersistent) { | 247 type != quota::kStorageTypePersistent) { |
| 249 // Unsupported storage types. | 248 // Unsupported storage types. |
| 250 Send(new QuotaMsg_DidFail(request_id, quota::kQuotaErrorNotSupported)); | 249 Send(new QuotaMsg_DidFail(request_id, quota::kQuotaErrorNotSupported)); |
| 251 return; | 250 return; |
| 252 } | 251 } |
| 253 | 252 |
| 254 RequestQuotaDispatcher* dispatcher = new RequestQuotaDispatcher( | 253 RequestQuotaDispatcher* dispatcher = new RequestQuotaDispatcher( |
| 255 this, request_id, origin, type, requested_size, render_view_id); | 254 this, request_id, origin, type, requested_size, render_view_id); |
| 256 dispatcher->Start(); | 255 dispatcher->Start(); |
| 257 } | 256 } |
| OLD | NEW |