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

Side by Side Diff: chrome/browser/extensions/extension_webrequest_api.cc

Issue 8491033: Extension Settings API: throttle the API in the same way that the Bookmarks API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync 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 #include "chrome/browser/extensions/extension_webrequest_api.h" 5 #include "chrome/browser/extensions/extension_webrequest_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/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 return true; 1595 return true;
1596 } 1596 }
1597 1597
1598 bool WebRequestHandlerBehaviorChanged::RunImpl() { 1598 bool WebRequestHandlerBehaviorChanged::RunImpl() {
1599 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 1599 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
1600 base::Bind(&ClearCacheOnNavigationOnUI)); 1600 base::Bind(&ClearCacheOnNavigationOnUI));
1601 return true; 1601 return true;
1602 } 1602 }
1603 1603
1604 void WebRequestHandlerBehaviorChanged::GetQuotaLimitHeuristics( 1604 void WebRequestHandlerBehaviorChanged::GetQuotaLimitHeuristics(
1605 std::list<QuotaLimitHeuristic*>* heuristics) const { 1605 QuotaLimitHeuristics* heuristics) const {
1606 QuotaLimitHeuristic::Config config = { 1606 QuotaLimitHeuristic::Config config = {
1607 20, // Refill 20 tokens per interval. 1607 20, // Refill 20 tokens per interval.
1608 base::TimeDelta::FromMinutes(10) // 10 minutes refill interval. 1608 base::TimeDelta::FromMinutes(10) // 10 minutes refill interval.
1609 }; 1609 };
1610 QuotaLimitHeuristic::BucketMapper* bucket_mapper = 1610 QuotaLimitHeuristic::BucketMapper* bucket_mapper =
1611 new QuotaLimitHeuristic::SingletonBucketMapper(); 1611 new QuotaLimitHeuristic::SingletonBucketMapper();
1612 ClearCacheQuotaHeuristic* heuristic = 1612 ClearCacheQuotaHeuristic* heuristic =
1613 new ClearCacheQuotaHeuristic(config, bucket_mapper); 1613 new ClearCacheQuotaHeuristic(config, bucket_mapper);
1614 heuristics->push_back(heuristic); 1614 heuristics->push_back(heuristic);
1615 } 1615 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 1648 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
1649 adblock = true; 1649 adblock = true;
1650 } else { 1650 } else {
1651 other = true; 1651 other = true;
1652 } 1652 }
1653 } 1653 }
1654 } 1654 }
1655 1655
1656 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 1656 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
1657 } 1657 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_webrequest_api.h ('k') | chrome/browser/extensions/settings/settings_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698