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

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 149737: Blacklist API change for allowing multiple rule matches... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 route_id, 351 route_id,
352 request_id, 352 request_id,
353 status, 353 status,
354 std::string())); // No security info needed, connection was not 354 std::string())); // No security info needed, connection was not
355 // established. 355 // established.
356 } 356 }
357 return; 357 return;
358 } 358 }
359 359
360 // Note that context can still be NULL here when running unit tests. 360 // Note that context can still be NULL here when running unit tests.
361 const Blacklist::Entry* entry = context && context->blacklist() ? 361 Blacklist::Match* match = context && context->blacklist() ?
362 context->blacklist()->findMatch(request_data.url) : NULL; 362 context->blacklist()->findMatch(request_data.url) : NULL;
363 if (entry && entry->IsBlocked(request_data.url)) { 363 if (match && match->IsBlocked(request_data.url)) {
364 // TODO(idanan): Send a ResourceResponse to replace the blocked resource. 364 // TODO(idanan): Send a ResourceResponse to replace the blocked resource.
365 delete match;
365 return; 366 return;
366 } 367 }
367 368
368 // Ensure the Chrome plugins are loaded, as they may intercept network 369 // Ensure the Chrome plugins are loaded, as they may intercept network
369 // requests. Does nothing if they are already loaded. 370 // requests. Does nothing if they are already loaded.
370 // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by 371 // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by
371 // starting the load earlier in a BG thread. 372 // starting the load earlier in a BG thread.
372 plugin_service_->LoadChromePlugins(this); 373 plugin_service_->LoadChromePlugins(this);
373 374
374 // Construct the event handler. 375 // Construct the event handler.
(...skipping 10 matching lines...) Expand all
385 } 386 }
386 387
387 if (HandleExternalProtocol(request_id, process_id, route_id, 388 if (HandleExternalProtocol(request_id, process_id, route_id,
388 request_data.url, request_data.resource_type, 389 request_data.url, request_data.resource_type,
389 handler)) { 390 handler)) {
390 return; 391 return;
391 } 392 }
392 393
393 // Construct the request. 394 // Construct the request.
394 URLRequest* request = new URLRequest(request_data.url, this); 395 URLRequest* request = new URLRequest(request_data.url, this);
395 if (entry && entry->attributes()) { 396 if (match) {
396 request->SetUserData((void*)&Blacklist::kRequestDataKey, 397 request->SetUserData((void*)&Blacklist::kRequestDataKey, match);
397 new Blacklist::RequestData(entry));
398 } 398 }
399 request->set_method(request_data.method); 399 request->set_method(request_data.method);
400 request->set_first_party_for_cookies(request_data.first_party_for_cookies); 400 request->set_first_party_for_cookies(request_data.first_party_for_cookies);
401 401
402 if (!entry || !(entry->attributes() & Blacklist::kDontSendReferrer)) 402 if (!match || !(match->attributes() & Blacklist::kDontSendReferrer))
403 request->set_referrer(request_data.referrer.spec()); 403 request->set_referrer(request_data.referrer.spec());
404 404
405 request->SetExtraRequestHeaders(request_data.headers); 405 request->SetExtraRequestHeaders(request_data.headers);
406 406
407 int load_flags = request_data.load_flags; 407 int load_flags = request_data.load_flags;
408 // EV certificate verification could be expensive. We don't want to spend 408 // EV certificate verification could be expensive. We don't want to spend
409 // time performing EV certificate verification on all resources because 409 // time performing EV certificate verification on all resources because
410 // EV status is irrelevant to sub-frames and sub-resources. 410 // EV status is irrelevant to sub-frames and sub-resources.
411 if (request_data.resource_type == ResourceType::MAIN_FRAME) 411 if (request_data.resource_type == ResourceType::MAIN_FRAME)
412 load_flags |= net::LOAD_VERIFY_EV_CERT; 412 load_flags |= net::LOAD_VERIFY_EV_CERT;
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 case ViewHostMsg_UploadProgress_ACK::ID: 1616 case ViewHostMsg_UploadProgress_ACK::ID:
1617 case ViewHostMsg_SyncLoad::ID: 1617 case ViewHostMsg_SyncLoad::ID:
1618 return true; 1618 return true;
1619 1619
1620 default: 1620 default:
1621 break; 1621 break;
1622 } 1622 }
1623 1623
1624 return false; 1624 return false;
1625 } 1625 }
OLDNEW
« no previous file with comments | « chrome/browser/privacy_blacklist/blacklist_unittest.cc ('k') | chrome/browser/renderer_host/resource_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698