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