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

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

Issue 10232004: Only apply extension throttling quota to sync, not local. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extensions_quota_service.h" 10 #include "chrome/browser/extensions/extensions_quota_service.h"
(...skipping 10 matching lines...) Expand all
21 const char* kUnsupportedArgumentType = "Unsupported argument type"; 21 const char* kUnsupportedArgumentType = "Unsupported argument type";
22 } // namespace 22 } // namespace
23 23
24 // SettingsFunction 24 // SettingsFunction
25 25
26 SettingsFunction::SettingsFunction() 26 SettingsFunction::SettingsFunction()
27 : settings_namespace_(settings_namespace::INVALID) {} 27 : settings_namespace_(settings_namespace::INVALID) {}
28 28
29 SettingsFunction::~SettingsFunction() {} 29 SettingsFunction::~SettingsFunction() {}
30 30
31 bool SettingsFunction::ShouldSkipQuotaLimiting() const {
32 // Only apply quota if this is for sync storage.
33 std::string settings_namespace_string;
34 if (!args_->GetString(0, &settings_namespace_string)) {
35 // This is an error but it will be caught in RunImpl(), there is no
36 // mechanism to signify an error from this function.
37 return false;
38 }
39 return settings_namespace_string != "sync";
40 }
41
31 bool SettingsFunction::RunImpl() { 42 bool SettingsFunction::RunImpl() {
32 { 43 {
33 std::string settings_namespace_string; 44 std::string settings_namespace_string;
34 EXTENSION_FUNCTION_VALIDATE( 45 EXTENSION_FUNCTION_VALIDATE(
35 args_->GetString(0, &settings_namespace_string)); 46 args_->GetString(0, &settings_namespace_string));
36 args_->Remove(0, NULL); 47 args_->Remove(0, NULL);
37 settings_namespace_ = 48 settings_namespace_ =
38 settings_namespace::FromString(settings_namespace_string); 49 settings_namespace::FromString(settings_namespace_string);
39 EXTENSION_FUNCTION_VALIDATE( 50 EXTENSION_FUNCTION_VALIDATE(
40 settings_namespace_ != settings_namespace::INVALID); 51 settings_namespace_ != settings_namespace::INVALID);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
263 return UseWriteResult(storage->Clear()); 274 return UseWriteResult(storage->Clear());
264 } 275 }
265 276
266 void ClearSettingsFunction::GetQuotaLimitHeuristics( 277 void ClearSettingsFunction::GetQuotaLimitHeuristics(
267 QuotaLimitHeuristics* heuristics) const { 278 QuotaLimitHeuristics* heuristics) const {
268 GetModificationQuotaLimitHeuristics(heuristics); 279 GetModificationQuotaLimitHeuristics(heuristics);
269 } 280 }
270 281
271 } // namespace extensions 282 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698