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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2545943003: Accessing navigation information via webcontents (Closed)
Patch Set: Post-Review Modifications #3 Created 4 years 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 | « no previous file | chrome/browser/net/resource_prefetch_predictor_observer.h » ('j') | 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 "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 resource_context, 502 resource_context,
503 resource_type, 503 resource_type,
504 throttles); 504 throttles);
505 #if !defined(DISABLE_NACL) 505 #if !defined(DISABLE_NACL)
506 AppendComponentUpdaterThrottles(request, *info, resource_context, 506 AppendComponentUpdaterThrottles(request, *info, resource_context,
507 resource_type, throttles); 507 resource_type, throttles);
508 #endif // !defined(DISABLE_NACL) 508 #endif // !defined(DISABLE_NACL)
509 509
510 if (io_data->resource_prefetch_predictor_observer()) { 510 if (io_data->resource_prefetch_predictor_observer()) {
511 io_data->resource_prefetch_predictor_observer()->OnRequestStarted( 511 io_data->resource_prefetch_predictor_observer()->OnRequestStarted(
512 request, resource_type, info->GetChildID(), info->GetRenderFrameID()); 512 request, resource_type, info->GetWebContentsGetterForRequest());
513 } 513 }
514 } 514 }
515 515
516 void ChromeResourceDispatcherHostDelegate::DownloadStarting( 516 void ChromeResourceDispatcherHostDelegate::DownloadStarting(
517 net::URLRequest* request, 517 net::URLRequest* request,
518 content::ResourceContext* resource_context, 518 content::ResourceContext* resource_context,
519 bool is_content_initiated, 519 bool is_content_initiated,
520 bool must_download, 520 bool must_download,
521 bool is_new_request, 521 bool is_new_request,
522 ScopedVector<content::ResourceThrottle>* throttles) { 522 ScopedVector<content::ResourceThrottle>* throttles) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 if (response_headers && 768 if (response_headers &&
769 !response_headers->HasHeaderValue("x-frame-options", "deny") && 769 !response_headers->HasHeaderValue("x-frame-options", "deny") &&
770 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { 770 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) {
771 response_headers->RemoveHeader("x-frame-options"); 771 response_headers->RemoveHeader("x-frame-options");
772 response_headers->AddHeader("x-frame-options: sameorigin"); 772 response_headers->AddHeader("x-frame-options: sameorigin");
773 } 773 }
774 } 774 }
775 #endif 775 #endif
776 776
777 if (io_data->resource_prefetch_predictor_observer()) 777 if (io_data->resource_prefetch_predictor_observer())
778 io_data->resource_prefetch_predictor_observer()->OnResponseStarted(request); 778 io_data->resource_prefetch_predictor_observer()->OnResponseStarted(
779 request, info->GetWebContentsGetterForRequest());
779 780
780 mod_pagespeed::RecordMetrics(info->GetResourceType(), request->url(), 781 mod_pagespeed::RecordMetrics(info->GetResourceType(), request->url(),
781 request->response_headers()); 782 request->response_headers());
782 } 783 }
783 784
784 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( 785 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
785 const GURL& redirect_url, 786 const GURL& redirect_url,
786 net::URLRequest* request, 787 net::URLRequest* request,
787 content::ResourceContext* resource_context, 788 content::ResourceContext* resource_context,
788 content::ResourceResponse* response) { 789 content::ResourceResponse* response) {
789 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 790 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
790 791
791 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 792 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
792 793
793 // In the Mirror world (for users that are signed in to the browser on 794 // In the Mirror world (for users that are signed in to the browser on
794 // Android, the identity is mirrored into the content area), Chrome should 795 // Android, the identity is mirrored into the content area), Chrome should
795 // append a X-Chrome-Connected header to all Gaia requests from a connected 796 // append a X-Chrome-Connected header to all Gaia requests from a connected
796 // profile so Gaia could return a 204 response and let Chrome handle the 797 // profile so Gaia could return a 204 response and let Chrome handle the
797 // action with native UI. The only exception is requests from gaia webview, 798 // action with native UI. The only exception is requests from gaia webview,
798 // since the native profile management UI is built on top of it. 799 // since the native profile management UI is built on top of it.
799 signin::FixMirrorRequestHeaderHelper(request, redirect_url, io_data, 800 signin::FixMirrorRequestHeaderHelper(request, redirect_url, io_data,
800 info->GetChildID(), info->GetRouteID()); 801 info->GetChildID(), info->GetRouteID());
801 802
802 if (io_data->resource_prefetch_predictor_observer()) { 803 if (io_data->resource_prefetch_predictor_observer()) {
803 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( 804 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected(
804 redirect_url, request); 805 request, redirect_url, info->GetWebContentsGetterForRequest());
805 } 806 }
806 807
807 if (io_data->policy_header_helper()) 808 if (io_data->policy_header_helper())
808 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); 809 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request);
809 } 810 }
810 811
811 // Notification that a request has completed. 812 // Notification that a request has completed.
812 void ChromeResourceDispatcherHostDelegate::RequestComplete( 813 void ChromeResourceDispatcherHostDelegate::RequestComplete(
813 net::URLRequest* url_request) { 814 net::URLRequest* url_request) {
814 if (!url_request) 815 if (!url_request)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 884 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
884 base::Unretained(this), url, request_loading_time)); 885 base::Unretained(this), url, request_loading_time));
885 return; 886 return;
886 } 887 }
887 888
888 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 889 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
889 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 890 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
890 rappor::SampleDomainAndRegistryFromGURL( 891 rappor::SampleDomainAndRegistryFromGURL(
891 g_browser_process->rappor_service(), metric_name, url); 892 g_browser_process->rappor_service(), metric_name, url);
892 } 893 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/resource_prefetch_predictor_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698