Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: chrome/browser/extensions/settings/settings_api.cc

Issue 10871034: Make all quota-exceeding messages in the storage API explain what the failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update... the other error message Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/extensions/settings/settings_api.h" 5 #include "chrome/browser/extensions/settings/settings_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 // Creates quota heuristics for settings modification. 148 // Creates quota heuristics for settings modification.
149 void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) { 149 void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) {
150 QuotaLimitHeuristic::Config longLimitConfig = { 150 QuotaLimitHeuristic::Config longLimitConfig = {
151 // See storage.json for current value. 151 // See storage.json for current value.
152 api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR, 152 api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR,
153 base::TimeDelta::FromHours(1) 153 base::TimeDelta::FromHours(1)
154 }; 154 };
155 heuristics->push_back( 155 heuristics->push_back(
156 new ExtensionsQuotaService::TimedLimit( 156 new ExtensionsQuotaService::TimedLimit(
157 longLimitConfig, new QuotaLimitHeuristic::SingletonBucketMapper())); 157 longLimitConfig,
158 new QuotaLimitHeuristic::SingletonBucketMapper(),
159 "MAX_WRITE_OPERATIONS_PER_HOUR"));
158 160
159 // A max of 10 operations per minute, sustained over 10 minutes. 161 // A max of 10 operations per minute, sustained over 10 minutes.
160 QuotaLimitHeuristic::Config shortLimitConfig = { 162 QuotaLimitHeuristic::Config shortLimitConfig = {
161 // See storage.json for current value. 163 // See storage.json for current value.
162 api::storage::sync::MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE, 164 api::storage::sync::MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE,
163 base::TimeDelta::FromMinutes(1) 165 base::TimeDelta::FromMinutes(1)
164 }; 166 };
165 heuristics->push_back( 167 heuristics->push_back(
166 new ExtensionsQuotaService::SustainedLimit( 168 new ExtensionsQuotaService::SustainedLimit(
167 base::TimeDelta::FromMinutes(10), 169 base::TimeDelta::FromMinutes(10),
168 shortLimitConfig, 170 shortLimitConfig,
169 new QuotaLimitHeuristic::SingletonBucketMapper())); 171 new QuotaLimitHeuristic::SingletonBucketMapper(),
172 "MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE"));
170 }; 173 };
171 174
172 } // namespace 175 } // namespace
173 176
174 bool GetSettingsFunction::RunWithStorage(ValueStore* storage) { 177 bool GetSettingsFunction::RunWithStorage(ValueStore* storage) {
175 Value* input = NULL; 178 Value* input = NULL;
176 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); 179 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input));
177 180
178 switch (input->GetType()) { 181 switch (input->GetType()) {
179 case Value::TYPE_NULL: 182 case Value::TYPE_NULL:
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 bool ClearSettingsFunction::RunWithStorage(ValueStore* storage) { 289 bool ClearSettingsFunction::RunWithStorage(ValueStore* storage) {
287 return UseWriteResult(storage->Clear()); 290 return UseWriteResult(storage->Clear());
288 } 291 }
289 292
290 void ClearSettingsFunction::GetQuotaLimitHeuristics( 293 void ClearSettingsFunction::GetQuotaLimitHeuristics(
291 QuotaLimitHeuristics* heuristics) const { 294 QuotaLimitHeuristics* heuristics) const {
292 GetModificationQuotaLimitHeuristics(heuristics); 295 GetModificationQuotaLimitHeuristics(heuristics);
293 } 296 }
294 297
295 } // namespace extensions 298 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698