| 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 "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/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 701 |
| 702 ExtensionWebRequestEventRouter::ExtensionWebRequestEventRouter() | 702 ExtensionWebRequestEventRouter::ExtensionWebRequestEventRouter() |
| 703 : request_time_tracker_(new ExtensionWebRequestTimeTracker) { | 703 : request_time_tracker_(new ExtensionWebRequestTimeTracker) { |
| 704 } | 704 } |
| 705 | 705 |
| 706 ExtensionWebRequestEventRouter::~ExtensionWebRequestEventRouter() { | 706 ExtensionWebRequestEventRouter::~ExtensionWebRequestEventRouter() { |
| 707 } | 707 } |
| 708 | 708 |
| 709 void ExtensionWebRequestEventRouter::RegisterRulesRegistry( | 709 void ExtensionWebRequestEventRouter::RegisterRulesRegistry( |
| 710 void* profile, | 710 void* profile, |
| 711 const RulesRegistryService::WebViewKey& webview_key, | 711 const extensions::RulesRegistry::WebViewKey& webview_key, |
| 712 scoped_refptr<extensions::WebRequestRulesRegistry> rules_registry) { | 712 scoped_refptr<extensions::WebRequestRulesRegistry> rules_registry) { |
| 713 RulesRegistryKey key(profile, webview_key); | 713 RulesRegistryKey key(profile, webview_key); |
| 714 if (rules_registry.get()) | 714 if (rules_registry.get()) |
| 715 rules_registries_[key] = rules_registry; | 715 rules_registries_[key] = rules_registry; |
| 716 else | 716 else |
| 717 rules_registries_.erase(key); | 717 rules_registries_.erase(key); |
| 718 } | 718 } |
| 719 | 719 |
| 720 int ExtensionWebRequestEventRouter::OnBeforeRequest( | 720 int ExtensionWebRequestEventRouter::OnBeforeRequest( |
| 721 void* profile, | 721 void* profile, |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( | 1972 bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( |
| 1973 void* profile, | 1973 void* profile, |
| 1974 InfoMap* extension_info_map, | 1974 InfoMap* extension_info_map, |
| 1975 const std::string& event_name, | 1975 const std::string& event_name, |
| 1976 net::URLRequest* request, | 1976 net::URLRequest* request, |
| 1977 extensions::RequestStage request_stage, | 1977 extensions::RequestStage request_stage, |
| 1978 const net::HttpResponseHeaders* original_response_headers) { | 1978 const net::HttpResponseHeaders* original_response_headers) { |
| 1979 extensions::WebViewRendererState::WebViewInfo web_view_info; | 1979 extensions::WebViewRendererState::WebViewInfo web_view_info; |
| 1980 bool is_web_view_guest = GetWebViewInfo(request, &web_view_info); | 1980 bool is_web_view_guest = GetWebViewInfo(request, &web_view_info); |
| 1981 | 1981 |
| 1982 RulesRegistryService::WebViewKey webview_key( | 1982 extensions::RulesRegistry::WebViewKey webview_key( |
| 1983 is_web_view_guest ? web_view_info.embedder_process_id : 0, | 1983 is_web_view_guest ? web_view_info.embedder_process_id : 0, |
| 1984 is_web_view_guest ? web_view_info.instance_id : 0); | 1984 is_web_view_guest ? web_view_info.instance_id : 0); |
| 1985 RulesRegistryKey rules_key(profile, webview_key); | 1985 RulesRegistryKey rules_key(profile, webview_key); |
| 1986 // If this check fails, check that the active stages are up-to-date in | 1986 // If this check fails, check that the active stages are up-to-date in |
| 1987 // extensions/browser/api/declarative_webrequest/request_stage.h . | 1987 // extensions/browser/api/declarative_webrequest/request_stage.h . |
| 1988 DCHECK(request_stage & extensions::kActiveStages); | 1988 DCHECK(request_stage & extensions::kActiveStages); |
| 1989 | 1989 |
| 1990 // Rules of the current |profile| may apply but we need to check also whether | 1990 // Rules of the current |profile| may apply but we need to check also whether |
| 1991 // there are applicable rules from extensions whose background page | 1991 // there are applicable rules from extensions whose background page |
| 1992 // spans from regular to incognito mode. | 1992 // spans from regular to incognito mode. |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2462 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); | 2462 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); |
| 2463 | 2463 |
| 2464 // Continue gracefully. | 2464 // Continue gracefully. |
| 2465 RunSync(); | 2465 RunSync(); |
| 2466 } | 2466 } |
| 2467 | 2467 |
| 2468 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2468 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
| 2469 helpers::ClearCacheOnNavigation(); | 2469 helpers::ClearCacheOnNavigation(); |
| 2470 return true; | 2470 return true; |
| 2471 } | 2471 } |
| OLD | NEW |