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

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

Issue 1336933002: Show hosted app requests to extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2454
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!extension_info_map) 156 if (!extension_info_map)
157 return false; 157 return false;
158 158
159 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 159 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
160 160
161 // If this request was not created by the ResourceDispatcher, |info| is NULL. 161 // If this request was not created by the ResourceDispatcher, |info| is NULL.
162 // All requests from extensions are created by the ResourceDispatcher. 162 // All requests from extensions are created by the ResourceDispatcher.
163 if (!info) 163 if (!info)
164 return false; 164 return false;
165 165
166 return extension_info_map->process_map().Contains(info->GetChildID()); 166 const std::set<std::string> extension_ids =
167 extension_info_map->process_map().GetExtensionsInProcess(
168 info->GetChildID());
169 if (extension_ids.empty())
170 return false;
171
172 // Treat hosted apps as normal web pages (crbug.com/526413).
173 for (const std::string& extension_id : extension_ids) {
174 const Extension* extension =
175 extension_info_map->extensions().GetByID(extension_id);
176 if (extension && !extension->is_hosted_app())
177 return true;
178 }
179 return false;
167 } 180 }
168 181
169 void ExtractRequestRoutingInfo(net::URLRequest* request, 182 void ExtractRequestRoutingInfo(net::URLRequest* request,
170 int* render_process_host_id, 183 int* render_process_host_id,
171 int* routing_id) { 184 int* routing_id) {
172 if (!request->GetUserData(NULL)) 185 if (!request->GetUserData(NULL))
173 return; 186 return;
174 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 187 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
175 *render_process_host_id = info->GetChildID(); 188 *render_process_host_id = info->GetChildID();
176 *routing_id = info->GetRouteID(); 189 *routing_id = info->GetRouteID();
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); 2486 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings));
2474 2487
2475 // Continue gracefully. 2488 // Continue gracefully.
2476 RunSync(); 2489 RunSync();
2477 } 2490 }
2478 2491
2479 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { 2492 bool WebRequestHandlerBehaviorChangedFunction::RunSync() {
2480 helpers::ClearCacheOnNavigation(); 2493 helpers::ClearCacheOnNavigation();
2481 return true; 2494 return true;
2482 } 2495 }
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