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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api.cc

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 7 months 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) 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 "chrome/browser/extensions/api/web_request/web_request_api.h" 5 #include "chrome/browser/extensions/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/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 } 1648 }
1649 } 1649 }
1650 1650
1651 ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled( 1651 ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled(
1652 profile_id(), extension_id(), event_name, sub_event_name, request_id, 1652 profile_id(), extension_id(), event_name, sub_event_name, request_id,
1653 response.release()); 1653 response.release());
1654 1654
1655 return true; 1655 return true;
1656 } 1656 }
1657 1657
1658 bool WebRequestHandlerBehaviorChanged::RunImpl() {
1659 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
1660 base::Bind(&ClearCacheOnNavigationOnUI));
1661 return true;
1662 }
1663
1664 void WebRequestHandlerBehaviorChanged::GetQuotaLimitHeuristics( 1658 void WebRequestHandlerBehaviorChanged::GetQuotaLimitHeuristics(
1665 QuotaLimitHeuristics* heuristics) const { 1659 QuotaLimitHeuristics* heuristics) const {
1666 QuotaLimitHeuristic::Config config = { 1660 QuotaLimitHeuristic::Config config = {
1667 20, // Refill 20 tokens per interval. 1661 20, // Refill 20 tokens per interval.
1668 base::TimeDelta::FromMinutes(10) // 10 minutes refill interval. 1662 base::TimeDelta::FromMinutes(10) // 10 minutes refill interval.
1669 }; 1663 };
1670 QuotaLimitHeuristic::BucketMapper* bucket_mapper = 1664 QuotaLimitHeuristic::BucketMapper* bucket_mapper =
1671 new QuotaLimitHeuristic::SingletonBucketMapper(); 1665 new QuotaLimitHeuristic::SingletonBucketMapper();
1672 ClearCacheQuotaHeuristic* heuristic = 1666 ClearCacheQuotaHeuristic* heuristic =
1673 new ClearCacheQuotaHeuristic(config, bucket_mapper); 1667 new ClearCacheQuotaHeuristic(config, bucket_mapper);
1674 heuristics->push_back(heuristic); 1668 heuristics->push_back(heuristic);
1675 } 1669 }
1676 1670
1677 void WebRequestHandlerBehaviorChanged::OnQuotaExceeded() { 1671 void WebRequestHandlerBehaviorChanged::OnQuotaExceeded() {
1678 // Post warning message. 1672 // Post warning message.
1679 std::set<std::string> extension_ids; 1673 std::set<std::string> extension_ids;
1680 extension_ids.insert(extension_id()); 1674 extension_ids.insert(extension_id());
1681 BrowserThread::PostTask( 1675 BrowserThread::PostTask(
1682 BrowserThread::UI, 1676 BrowserThread::UI,
1683 FROM_HERE, 1677 FROM_HERE,
1684 base::Bind(&ExtensionWarningSet::NotifyWarningsOnUI, 1678 base::Bind(&ExtensionWarningSet::NotifyWarningsOnUI,
1685 profile_id(), 1679 profile_id(),
1686 extension_ids, 1680 extension_ids,
1687 ExtensionWarningSet::kRepeatedCacheFlushes)); 1681 ExtensionWarningSet::kRepeatedCacheFlushes));
1688 1682
1689 // Continue gracefully. 1683 // Continue gracefully.
1690 Run(); 1684 Run();
1691 } 1685 }
1692 1686
1687 bool WebRequestHandlerBehaviorChanged::RunImpl() {
1688 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
1689 base::Bind(&ClearCacheOnNavigationOnUI));
1690 return true;
1691 }
1692
1693 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { 1693 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) {
1694 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); 1694 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
1695 if (!profile || !profile->GetExtensionService()) 1695 if (!profile || !profile->GetExtensionService())
1696 return; 1696 return;
1697 1697
1698 bool adblock = false; 1698 bool adblock = false;
1699 bool adblock_plus = false; 1699 bool adblock_plus = false;
1700 bool other = false; 1700 bool other = false;
1701 const ExtensionSet* extensions = 1701 const ExtensionSet* extensions =
1702 profile->GetExtensionService()->extensions(); 1702 profile->GetExtensionService()->extensions();
1703 for (ExtensionSet::const_iterator it = extensions->begin(); 1703 for (ExtensionSet::const_iterator it = extensions->begin();
1704 it != extensions->end(); ++it) { 1704 it != extensions->end(); ++it) {
1705 if (profile->GetExtensionService()->HasUsedWebRequest(*it)) { 1705 if (profile->GetExtensionService()->HasUsedWebRequest(*it)) {
1706 if ((*it)->name().find("Adblock Plus") != std::string::npos) { 1706 if ((*it)->name().find("Adblock Plus") != std::string::npos) {
1707 adblock_plus = true; 1707 adblock_plus = true;
1708 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 1708 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
1709 adblock = true; 1709 adblock = true;
1710 } else { 1710 } else {
1711 other = true; 1711 other = true;
1712 } 1712 }
1713 } 1713 }
1714 } 1714 }
1715 1715
1716 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 1716 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
1717 } 1717 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698