Chromium Code Reviews| Index: chrome/browser/extensions/api/web_request/web_request_api.cc |
| diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc |
| index fce2f1fea9094b57f1169a945d9ad164f7ff3ec2..db113aafb9d9f5454dd2c0fa96727a7972a16654 100644 |
| --- a/chrome/browser/extensions/api/web_request/web_request_api.cc |
| +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc |
| @@ -77,6 +77,7 @@ using extensions::ExtensionWarning; |
| using extensions::ExtensionWarningService; |
| using extensions::ExtensionWarningSet; |
| using extensions::Feature; |
| +using extensions::RulesRegistryService; |
| using extensions::web_navigation_api_helpers::GetFrameId; |
| namespace helpers = extension_web_request_api_helpers; |
| @@ -599,11 +600,13 @@ ExtensionWebRequestEventRouter::~ExtensionWebRequestEventRouter() { |
| void ExtensionWebRequestEventRouter::RegisterRulesRegistry( |
| void* profile, |
| + const RulesRegistryService::WebViewKey& webview_key, |
| scoped_refptr<extensions::WebRequestRulesRegistry> rules_registry) { |
| + std::pair<void*, RulesRegistryService::WebViewKey> key(profile, webview_key); |
|
vabr (Chromium)
2013/10/25 20:40:24
Use the already defined typedef RulesRegistryKey i
Fady Samuel
2013/10/25 22:48:08
This is a <std::string, WebViewKey> pair, instead
vabr (Chromium)
2013/10/28 14:46:09
I think there is a misunderstanding.
In web_reques
|
| if (rules_registry.get()) |
| - rules_registries_[profile] = rules_registry; |
| + rules_registries_[key] = rules_registry; |
| else |
| - rules_registries_.erase(profile); |
| + rules_registries_.erase(key); |
| } |
| int ExtensionWebRequestEventRouter::OnBeforeRequest( |
| @@ -1843,6 +1846,29 @@ bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( |
| net::URLRequest* request, |
| extensions::RequestStage request_stage, |
| const net::HttpResponseHeaders* original_response_headers) { |
| + bool is_main_frame = false; |
| + int64 frame_id = -1; |
| + bool parent_is_main_frame = false; |
| + int64 parent_frame_id = -1; |
| + int tab_id = -1; |
| + int window_id = -1; |
| + int render_process_host_id = -1; |
| + int routing_id = -1; |
| + ResourceType::Type resource_type = ResourceType::LAST_TYPE; |
| + |
| + ExtractRequestInfoDetails(request, &is_main_frame, &frame_id, |
| + &parent_is_main_frame, &parent_frame_id, |
| + &tab_id, &window_id, &render_process_host_id, |
| + &routing_id, &resource_type); |
| + ExtensionRendererState::WebViewInfo webview_info; |
| + bool is_guest = ExtensionRendererState::GetInstance()-> |
|
vabr (Chromium)
2013/10/25 20:40:24
What does "guest" mean in this context?
Fady Samuel
2013/10/25 22:48:08
The content of a <webview> lives in an different p
vabr (Chromium)
2013/10/28 14:46:09
OK, that makes sense. Could you please add this ex
|
| + GetWebViewInfo(render_process_host_id, routing_id, &webview_info); |
| + |
| + RulesRegistryService::WebViewKey webview_key( |
| + is_guest ? webview_info.embedder_process_id : 0, |
| + webview_info.instance_id); |
| + RulesRegistryKey rules_key(profile, webview_key); |
| + |
| // If this check fails, check that the active stages are up-to-date in |
| // browser/extensions/api/declarative_webrequest/request_stage.h . |
| DCHECK(request_stage & extensions::kActiveStages); |
| @@ -1858,16 +1884,16 @@ bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( |
| typedef std::vector<RelevantRegistry> RelevantRegistries; |
| RelevantRegistries relevant_registries; |
| - if (rules_registries_.find(profile) != rules_registries_.end()) { |
| + if (rules_registries_.find(rules_key) != rules_registries_.end()) { |
| relevant_registries.push_back( |
| - std::make_pair(rules_registries_[profile].get(), false)); |
| + std::make_pair(rules_registries_[rules_key].get(), false)); |
| } |
| void* cross_profile = GetCrossProfile(profile); |
| if (cross_profile && |
| - rules_registries_.find(cross_profile) != rules_registries_.end()) { |
| + rules_registries_.find(rules_key) != rules_registries_.end()) { |
|
vabr (Chromium)
2013/10/25 20:40:24
|cross_profile| is not contained in rules_key -- i
Fady Samuel
2013/10/25 22:48:08
Good catch! Fixed. Added a cross_profile_rules_key
|
| relevant_registries.push_back( |
| - std::make_pair(rules_registries_[cross_profile].get(), true)); |
| + std::make_pair(rules_registries_[rules_key].get(), true)); |
| } |
| // The following block is experimentally enabled and its impact on load time |