| 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 #include "extensions/browser/api/web_request/web_request_api.h" | 5 #include "extensions/browser/api/web_request/web_request_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 public: | 2123 public: |
| 2124 ClearCacheQuotaHeuristic(const Config& config, BucketMapper* map) | 2124 ClearCacheQuotaHeuristic(const Config& config, BucketMapper* map) |
| 2125 : QuotaLimitHeuristic( | 2125 : QuotaLimitHeuristic( |
| 2126 config, | 2126 config, |
| 2127 map, | 2127 map, |
| 2128 "MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES"), | 2128 "MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES"), |
| 2129 callback_registered_(false), | 2129 callback_registered_(false), |
| 2130 weak_ptr_factory_(this) {} | 2130 weak_ptr_factory_(this) {} |
| 2131 virtual ~ClearCacheQuotaHeuristic() {} | 2131 virtual ~ClearCacheQuotaHeuristic() {} |
| 2132 virtual bool Apply(Bucket* bucket, | 2132 virtual bool Apply(Bucket* bucket, |
| 2133 const base::TimeTicks& event_time) OVERRIDE; | 2133 const base::TimeTicks& event_time) override; |
| 2134 | 2134 |
| 2135 private: | 2135 private: |
| 2136 // Callback that is triggered by the ExtensionWebRequestEventRouter on a page | 2136 // Callback that is triggered by the ExtensionWebRequestEventRouter on a page |
| 2137 // load. | 2137 // load. |
| 2138 // | 2138 // |
| 2139 // We don't need to take care of the life time of |bucket|: It is owned by the | 2139 // We don't need to take care of the life time of |bucket|: It is owned by the |
| 2140 // BucketMapper of our base class in |QuotaLimitHeuristic::bucket_mapper_|. As | 2140 // BucketMapper of our base class in |QuotaLimitHeuristic::bucket_mapper_|. As |
| 2141 // long as |this| exists, the respective BucketMapper and its bucket will | 2141 // long as |this| exists, the respective BucketMapper and its bucket will |
| 2142 // exist as well. | 2142 // exist as well. |
| 2143 void OnPageLoad(Bucket* bucket); | 2143 void OnPageLoad(Bucket* bucket); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); | 2451 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); |
| 2452 | 2452 |
| 2453 // Continue gracefully. | 2453 // Continue gracefully. |
| 2454 RunSync(); | 2454 RunSync(); |
| 2455 } | 2455 } |
| 2456 | 2456 |
| 2457 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2457 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
| 2458 helpers::ClearCacheOnNavigation(); | 2458 helpers::ClearCacheOnNavigation(); |
| 2459 return true; | 2459 return true; |
| 2460 } | 2460 } |
| OLD | NEW |