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

Side by Side Diff: ios/web/webui/url_data_manager_ios_backend.mm

Issue 2856093004: Generalize content::URLDataSource so that it can be used by the network service. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/webui/url_data_manager_ios_backend.h" 5 #include "ios/web/webui/url_data_manager_ios_backend.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 428
429 bool URLDataManagerIOSBackend::StartRequest(const net::URLRequest* request, 429 bool URLDataManagerIOSBackend::StartRequest(const net::URLRequest* request,
430 URLRequestChromeJob* job) { 430 URLRequestChromeJob* job) {
431 if (!CheckURLIsValid(request->url())) 431 if (!CheckURLIsValid(request->url()))
432 return false; 432 return false;
433 433
434 URLDataSourceIOSImpl* source = GetDataSourceFromURL(request->url()); 434 URLDataSourceIOSImpl* source = GetDataSourceFromURL(request->url());
435 if (!source) 435 if (!source)
436 return false; 436 return false;
437 437
438 if (!source->source()->ShouldServiceRequest(request)) 438 if (!source->source()->ShouldServiceRequest(request->url()))
439 return false; 439 return false;
440 440
441 std::string path; 441 std::string path;
442 URLToRequestPath(request->url(), &path); 442 URLToRequestPath(request->url(), &path);
443 source->source()->WillServiceRequest(request, &path);
444 443
445 // Save this request so we know where to send the data. 444 // Save this request so we know where to send the data.
446 RequestID request_id = next_request_id_++; 445 RequestID request_id = next_request_id_++;
447 pending_requests_.insert(std::make_pair(request_id, job)); 446 pending_requests_.insert(std::make_pair(request_id, job));
448 447
449 job->set_allow_caching(source->source()->AllowCaching()); 448 job->set_allow_caching(source->source()->AllowCaching());
450 job->set_add_content_security_policy(true); 449 job->set_add_content_security_policy(true);
451 job->set_content_security_policy_object_source( 450 job->set_content_security_policy_object_source(
452 source->source()->GetContentSecurityPolicyObjectSrc()); 451 source->source()->GetContentSecurityPolicyObjectSrc());
453 job->set_content_security_policy_frame_source("frame-src 'none';"); 452 job->set_content_security_policy_frame_source("frame-src 'none';");
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // Forward this data on to the pending net::URLRequest, if it exists. 515 // Forward this data on to the pending net::URLRequest, if it exists.
517 PendingRequestMap::iterator i = pending_requests_.find(request_id); 516 PendingRequestMap::iterator i = pending_requests_.find(request_id);
518 if (i != pending_requests_.end()) { 517 if (i != pending_requests_.end()) {
519 URLRequestChromeJob* job(i->second); 518 URLRequestChromeJob* job(i->second);
520 pending_requests_.erase(i); 519 pending_requests_.erase(i);
521 job->DataAvailable(bytes); 520 job->DataAvailable(bytes);
522 } 521 }
523 } 522 }
524 523
525 } // namespace web 524 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698