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 #pragma once | |
17 | 16 |
18 #include <list> | 17 #include <list> |
19 #include <map> | 18 #include <map> |
20 #include <string> | 19 #include <string> |
21 | 20 |
22 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
23 #include "base/hash_tables.h" | 22 #include "base/hash_tables.h" |
24 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
25 #include "base/threading/non_thread_safe.h" | 24 #include "base/threading/non_thread_safe.h" |
26 #include "base/time.h" | 25 #include "base/time.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 virtual bool Apply(Bucket* bucket, | 214 virtual bool Apply(Bucket* bucket, |
216 const base::TimeTicks& event_time) OVERRIDE; | 215 const base::TimeTicks& event_time) OVERRIDE; |
217 private: | 216 private: |
218 // Specifies how long exhaustion of buckets is allowed to continue before | 217 // Specifies how long exhaustion of buckets is allowed to continue before |
219 // denying requests. | 218 // denying requests. |
220 const int64 repeat_exhaustion_allowance_; | 219 const int64 repeat_exhaustion_allowance_; |
221 int64 num_available_repeat_exhaustions_; | 220 int64 num_available_repeat_exhaustions_; |
222 }; | 221 }; |
223 | 222 |
224 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ | 223 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_QUOTA_SERVICE_H_ |
OLD | NEW |