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

Side by Side Diff: chrome/browser/extensions/extensions_quota_service.h

Issue 8473003: Add OVERRIDE to chrome/browser/extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // The ExtensionsQuotaService uses heuristics to limit abusive requests 5 // The ExtensionsQuotaService uses heuristics to limit abusive requests
6 // made by extensions. In this model 'items' (e.g individual bookmarks) are 6 // made by extensions. In this model 'items' (e.g individual bookmarks) are
7 // represented by a 'Bucket' that holds state for that item for one single 7 // represented by a 'Bucket' that holds state for that item for one single
8 // interval of time. The interval of time is defined as 'how long we need to 8 // interval of time. The interval of time is defined as 'how long we need to
9 // watch an item (for a particular heuristic) before making a decision about 9 // watch an item (for a particular heuristic) before making a decision about
10 // quota violations'. A heuristic is two functions: one mapping input 10 // quota violations'. A heuristic is two functions: one mapping input
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 DISALLOW_COPY_AND_ASSIGN(QuotaLimitHeuristic); 184 DISALLOW_COPY_AND_ASSIGN(QuotaLimitHeuristic);
185 }; 185 };
186 186
187 // A simple per-item heuristic to limit the number of events that can occur in 187 // A simple per-item heuristic to limit the number of events that can occur in
188 // a given period of time; e.g "no more than 100 events in an hour". 188 // a given period of time; e.g "no more than 100 events in an hour".
189 class ExtensionsQuotaService::TimedLimit : public QuotaLimitHeuristic { 189 class ExtensionsQuotaService::TimedLimit : public QuotaLimitHeuristic {
190 public: 190 public:
191 TimedLimit(const Config& config, BucketMapper* map) 191 TimedLimit(const Config& config, BucketMapper* map)
192 : QuotaLimitHeuristic(config, map) {} 192 : QuotaLimitHeuristic(config, map) {}
193 virtual bool Apply(Bucket* bucket, const base::TimeTicks& event_time); 193 virtual bool Apply(Bucket* bucket,
194 const base::TimeTicks& event_time) OVERRIDE;
194 }; 195 };
195 196
196 // A per-item heuristic to limit the number of events that can occur in a 197 // A per-item heuristic to limit the number of events that can occur in a
197 // period of time over a sustained longer interval. E.g "no more than two 198 // period of time over a sustained longer interval. E.g "no more than two
198 // events per minute, sustained over 10 minutes". 199 // events per minute, sustained over 10 minutes".
199 class ExtensionsQuotaService::SustainedLimit : public QuotaLimitHeuristic { 200 class ExtensionsQuotaService::SustainedLimit : public QuotaLimitHeuristic {
200 public: 201 public:
201 SustainedLimit(const base::TimeDelta& sustain, 202 SustainedLimit(const base::TimeDelta& sustain,
202 const Config& config, 203 const Config& config,
203 BucketMapper* map); 204 BucketMapper* map);
204 virtual bool Apply(Bucket* bucket, const base::TimeTicks& event_time); 205 virtual bool Apply(Bucket* bucket,
206 const base::TimeTicks& event_time) OVERRIDE;
205 private: 207 private:
206 // Specifies how long exhaustion of buckets is allowed to continue before 208 // Specifies how long exhaustion of buckets is allowed to continue before
207 // denying requests. 209 // denying requests.
208 const int64 repeat_exhaustion_allowance_; 210 const int64 repeat_exhaustion_allowance_;
209 int64 num_available_repeat_exhaustions_; 211 int64 num_available_repeat_exhaustions_;
210 }; 212 };
211 213
212 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ 214 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_webstore_private_api.h ('k') | chrome/browser/extensions/extensions_startup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698