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 // 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 |
11 // arguments to a unique Bucket (the BucketMapper), and another to determine | 11 // arguments to a unique Bucket (the BucketMapper), and another to determine |
12 // if a new request involving such an item at a given time is a violation. | 12 // if a new request involving such an item at a given time is a violation. |
13 | 13 |
14 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ | 14 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ |
15 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ | 15 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ |
16 | 16 |
17 #include <list> | 17 #include <list> |
18 #include <map> | 18 #include <map> |
19 #include <string> | 19 #include <string> |
20 | 20 |
21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
22 #include "base/hash_tables.h" | 22 #include "base/containers/hash_tables.h" |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/threading/non_thread_safe.h" | 24 #include "base/threading/non_thread_safe.h" |
25 #include "base/time.h" | 25 #include "base/time.h" |
26 #include "base/timer.h" | 26 #include "base/timer.h" |
27 #include "base/values.h" | 27 #include "base/values.h" |
28 | 28 |
29 class ExtensionFunction; | 29 class ExtensionFunction; |
30 class QuotaLimitHeuristic; | 30 class QuotaLimitHeuristic; |
31 typedef std::list<QuotaLimitHeuristic*> QuotaLimitHeuristics; | 31 typedef std::list<QuotaLimitHeuristic*> QuotaLimitHeuristics; |
32 | 32 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 virtual bool Apply(Bucket* bucket, | 228 virtual bool Apply(Bucket* bucket, |
229 const base::TimeTicks& event_time) OVERRIDE; | 229 const base::TimeTicks& event_time) OVERRIDE; |
230 private: | 230 private: |
231 // Specifies how long exhaustion of buckets is allowed to continue before | 231 // Specifies how long exhaustion of buckets is allowed to continue before |
232 // denying requests. | 232 // denying requests. |
233 const int64 repeat_exhaustion_allowance_; | 233 const int64 repeat_exhaustion_allowance_; |
234 int64 num_available_repeat_exhaustions_; | 234 int64 num_available_repeat_exhaustions_; |
235 }; | 235 }; |
236 | 236 |
237 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ | 237 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ |
OLD | NEW |