| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quota_dispatcher_host.h" | 5 #include "content/browser/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 "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "content/common/quota_messages.h" | 10 #include "content/common/quota_messages.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 int process_id, | 213 int process_id, |
| 214 QuotaManager* quota_manager, | 214 QuotaManager* quota_manager, |
| 215 QuotaPermissionContext* permission_context) | 215 QuotaPermissionContext* permission_context) |
| 216 : BrowserMessageFilter(QuotaMsgStart), | 216 : BrowserMessageFilter(QuotaMsgStart), |
| 217 process_id_(process_id), | 217 process_id_(process_id), |
| 218 quota_manager_(quota_manager), | 218 quota_manager_(quota_manager), |
| 219 permission_context_(permission_context), | 219 permission_context_(permission_context), |
| 220 weak_factory_(this) { | 220 weak_factory_(this) { |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool QuotaDispatcherHost::OnMessageReceived( | 223 bool QuotaDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
| 224 const IPC::Message& message, bool* message_was_ok) { | |
| 225 *message_was_ok = true; | |
| 226 bool handled = true; | 224 bool handled = true; |
| 227 IPC_BEGIN_MESSAGE_MAP_EX(QuotaDispatcherHost, message, *message_was_ok) | 225 IPC_BEGIN_MESSAGE_MAP(QuotaDispatcherHost, message) |
| 228 IPC_MESSAGE_HANDLER(QuotaHostMsg_QueryStorageUsageAndQuota, | 226 IPC_MESSAGE_HANDLER(QuotaHostMsg_QueryStorageUsageAndQuota, |
| 229 OnQueryStorageUsageAndQuota) | 227 OnQueryStorageUsageAndQuota) |
| 230 IPC_MESSAGE_HANDLER(QuotaHostMsg_RequestStorageQuota, | 228 IPC_MESSAGE_HANDLER(QuotaHostMsg_RequestStorageQuota, |
| 231 OnRequestStorageQuota) | 229 OnRequestStorageQuota) |
| 232 IPC_MESSAGE_UNHANDLED(handled = false) | 230 IPC_MESSAGE_UNHANDLED(handled = false) |
| 233 IPC_END_MESSAGE_MAP_EX() | 231 IPC_END_MESSAGE_MAP() |
| 234 return handled; | 232 return handled; |
| 235 } | 233 } |
| 236 | 234 |
| 237 QuotaDispatcherHost::~QuotaDispatcherHost() {} | 235 QuotaDispatcherHost::~QuotaDispatcherHost() {} |
| 238 | 236 |
| 239 void QuotaDispatcherHost::OnQueryStorageUsageAndQuota( | 237 void QuotaDispatcherHost::OnQueryStorageUsageAndQuota( |
| 240 int request_id, | 238 int request_id, |
| 241 const GURL& origin, | 239 const GURL& origin, |
| 242 StorageType type) { | 240 StorageType type) { |
| 243 QueryUsageAndQuotaDispatcher* dispatcher = new QueryUsageAndQuotaDispatcher( | 241 QueryUsageAndQuotaDispatcher* dispatcher = new QueryUsageAndQuotaDispatcher( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 255 return; | 253 return; |
| 256 } | 254 } |
| 257 | 255 |
| 258 RequestQuotaDispatcher* dispatcher = | 256 RequestQuotaDispatcher* dispatcher = |
| 259 new RequestQuotaDispatcher(weak_factory_.GetWeakPtr(), | 257 new RequestQuotaDispatcher(weak_factory_.GetWeakPtr(), |
| 260 params); | 258 params); |
| 261 dispatcher->Start(); | 259 dispatcher->Start(); |
| 262 } | 260 } |
| 263 | 261 |
| 264 } // namespace content | 262 } // namespace content |
| OLD | NEW |