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

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

Issue 1330263002: Show hosted app requests to extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2490
Patch Set: Created 5 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
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest_hosted_app/manifest.json ('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 "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
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
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
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest_hosted_app/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698