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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 host_(net::GetHostOrSpecFromURL(origin)), | 102 host_(net::GetHostOrSpecFromURL(origin)), |
103 type_(type), | 103 type_(type), |
104 current_quota_(0), | 104 current_quota_(0), |
105 requested_quota_(requested_quota), | 105 requested_quota_(requested_quota), |
106 render_view_id_(render_view_id), | 106 render_view_id_(render_view_id), |
107 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} | 107 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} |
108 virtual ~RequestQuotaDispatcher() {} | 108 virtual ~RequestQuotaDispatcher() {} |
109 | 109 |
110 void Start() { | 110 void Start() { |
111 DCHECK(type_ == quota::kStorageTypeTemporary || | 111 DCHECK(type_ == quota::kStorageTypeTemporary || |
112 type_ == quota::kStorageTypePersistent); | 112 type_ == quota::kStorageTypePersistent || |
| 113 type_ == quota::kStorageTypeSyncable); |
113 if (type_ == quota::kStorageTypePersistent) { | 114 if (type_ == quota::kStorageTypePersistent) { |
114 quota_manager()->GetPersistentHostQuota( | 115 quota_manager()->GetPersistentHostQuota( |
115 host_, | 116 host_, |
116 base::Bind(&self_type::DidGetHostQuota, | 117 base::Bind(&self_type::DidGetHostQuota, |
117 weak_factory_.GetWeakPtr(), host_, type_)); | 118 weak_factory_.GetWeakPtr(), host_, type_)); |
118 } else { | 119 } else { |
119 quota_manager()->GetUsageAndQuota( | 120 quota_manager()->GetUsageAndQuota( |
120 origin_, type_, | 121 origin_, type_, |
121 base::Bind(&self_type::DidGetTemporaryUsageAndQuota, | 122 base::Bind(&self_type::DidGetTemporaryUsageAndQuota, |
122 weak_factory_.GetWeakPtr())); | 123 weak_factory_.GetWeakPtr())); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 Send(new QuotaMsg_DidFail(request_id, quota::kQuotaErrorNotSupported)); | 249 Send(new QuotaMsg_DidFail(request_id, quota::kQuotaErrorNotSupported)); |
249 return; | 250 return; |
250 } | 251 } |
251 | 252 |
252 RequestQuotaDispatcher* dispatcher = new RequestQuotaDispatcher( | 253 RequestQuotaDispatcher* dispatcher = new RequestQuotaDispatcher( |
253 this, request_id, origin, type, requested_size, render_view_id); | 254 this, request_id, origin, type, requested_size, render_view_id); |
254 dispatcher->Start(); | 255 dispatcher->Start(); |
255 } | 256 } |
256 | 257 |
257 } // namespace content | 258 } // namespace content |
OLD | NEW |