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

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

Issue 10905040: Clear in-memory caches of renderers when rules change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Previous version was incomplete Created 8 years, 3 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
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_helpers.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 12 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
13 #include "chrome/browser/renderer_host/web_cache_manager.h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "content/public/browser/browser_thread.h"
14 #include "net/base/net_log.h" 16 #include "net/base/net_log.h"
15 #include "net/cookies/parsed_cookie.h" 17 #include "net/cookies/parsed_cookie.h"
16 #include "net/http/http_util.h" 18 #include "net/http/http_util.h"
17 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
18 20
19 namespace extension_web_request_api_helpers { 21 namespace extension_web_request_api_helpers {
20 22
21 namespace { 23 namespace {
22 24
23 // A ParsedRequestCookie consists of the key and value of the cookie. 25 // A ParsedRequestCookie consists of the key and value of the cookie.
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1012 }
1011 1013
1012 bool CanExtensionAccessURL(const extensions::Extension* extension, 1014 bool CanExtensionAccessURL(const extensions::Extension* extension,
1013 const GURL& url) { 1015 const GURL& url) {
1014 // about: URLs are not covered in host permissions, but are allowed anyway. 1016 // about: URLs are not covered in host permissions, but are allowed anyway.
1015 return (url.SchemeIs(chrome::kAboutScheme) || 1017 return (url.SchemeIs(chrome::kAboutScheme) ||
1016 extension->HasHostPermission(url) || 1018 extension->HasHostPermission(url) ||
1017 url.GetOrigin() == extension->url()); 1019 url.GetOrigin() == extension->url());
1018 } 1020 }
1019 1021
1022 namespace {
Yoyo Zhou 2012/08/31 20:24:57 I understand why you might want to keep this code
battre 2012/09/03 09:56:44 Done.
1023 void ClearCacheOnNavigationOnUI() {
1024 WebCacheManager::GetInstance()->ClearCacheOnNavigation();
1025 }
1026 } // namespace
1027
1028 void ClearCacheOnNavigation() {
1029 if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
1030 ClearCacheOnNavigationOnUI();
1031 } else {
1032 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
1033 base::Bind(&ClearCacheOnNavigationOnUI));
1034 }
1035 }
1036
1037
1020 } // namespace extension_web_request_api_helpers 1038 } // namespace extension_web_request_api_helpers
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698