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 "extensions/browser/api/web_request/web_request_api.h" | 5 #include "extensions/browser/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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (!extension_info_map) | 152 if (!extension_info_map) |
153 return false; | 153 return false; |
154 | 154 |
155 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 155 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
156 | 156 |
157 // If this request was not created by the ResourceDispatcher, |info| is NULL. | 157 // If this request was not created by the ResourceDispatcher, |info| is NULL. |
158 // All requests from extensions are created by the ResourceDispatcher. | 158 // All requests from extensions are created by the ResourceDispatcher. |
159 if (!info) | 159 if (!info) |
160 return false; | 160 return false; |
161 | 161 |
162 return extension_info_map->process_map().Contains(info->GetChildID()); | 162 const std::set<std::string> extension_ids = |
| 163 extension_info_map->process_map().GetExtensionsInProcess( |
| 164 info->GetChildID()); |
| 165 if (extension_ids.empty()) |
| 166 return false; |
| 167 |
| 168 // Treat hosted apps as normal web pages (crbug.com/526413). |
| 169 for (const std::string& extension_id : extension_ids) { |
| 170 const Extension* extension = |
| 171 extension_info_map->extensions().GetByID(extension_id); |
| 172 if (extension && !extension->is_hosted_app()) |
| 173 return true; |
| 174 } |
| 175 return false; |
163 } | 176 } |
164 | 177 |
165 void ExtractRequestRoutingInfo(const net::URLRequest* request, | 178 void ExtractRequestRoutingInfo(const net::URLRequest* request, |
166 int* render_process_host_id, | 179 int* render_process_host_id, |
167 int* routing_id) { | 180 int* routing_id) { |
168 if (!request->GetUserData(NULL)) | 181 if (!request->GetUserData(NULL)) |
169 return; | 182 return; |
170 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 183 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
171 *render_process_host_id = info->GetChildID(); | 184 *render_process_host_id = info->GetChildID(); |
172 *routing_id = info->GetRouteID(); | 185 *routing_id = info->GetRouteID(); |
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 // Continue gracefully. | 2482 // Continue gracefully. |
2470 RunSync(); | 2483 RunSync(); |
2471 } | 2484 } |
2472 | 2485 |
2473 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2486 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
2474 helpers::ClearCacheOnNavigation(); | 2487 helpers::ClearCacheOnNavigation(); |
2475 return true; | 2488 return true; |
2476 } | 2489 } |
2477 | 2490 |
2478 } // namespace extensions | 2491 } // namespace extensions |
OLD | NEW |