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

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

Issue 2258483002: X-Chrome-Connected is stripped when it should not be in headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Addressed Created 4 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
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/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 variations::AppendVariationHeaders( 467 variations::AppendVariationHeaders(
468 request->url(), is_off_the_record, 468 request->url(), is_off_the_record,
469 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), 469 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(),
470 &headers); 470 &headers);
471 request->SetExtraRequestHeaders(headers); 471 request->SetExtraRequestHeaders(headers);
472 } 472 }
473 473
474 if (io_data->policy_header_helper()) 474 if (io_data->policy_header_helper())
475 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); 475 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request);
476 476
477 signin::AppendMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, 477 signin::FixMirrorRequestHeaderHelper(request, GURL() /* redirect_url */,
478 io_data, info->GetChildID(), 478 io_data, info->GetChildID(),
479 info->GetRouteID()); 479 info->GetRouteID());
480 480
481 AppendStandardResourceThrottles(request, 481 AppendStandardResourceThrottles(request,
482 resource_context, 482 resource_context,
483 resource_type, 483 resource_type,
484 throttles); 484 throttles);
485 #if !defined(DISABLE_NACL) 485 #if !defined(DISABLE_NACL)
486 if (!is_prerendering) { 486 if (!is_prerendering) {
487 AppendComponentUpdaterThrottles(request, 487 AppendComponentUpdaterThrottles(request,
488 resource_context, 488 resource_context,
489 resource_type, 489 resource_type,
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 793
794 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( 794 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
795 const GURL& redirect_url, 795 const GURL& redirect_url,
796 net::URLRequest* request, 796 net::URLRequest* request,
797 content::ResourceContext* resource_context, 797 content::ResourceContext* resource_context,
798 content::ResourceResponse* response) { 798 content::ResourceResponse* response) {
799 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 799 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
800 800
801 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 801 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
802 802
803 // In the Mirror world, Chrome should append a X-Chrome-Connected header to 803 // In the Mirror world (for users that are signed in to the browser on
804 // all Gaia requests from a connected profile so Gaia could return a 204 804 // Android, the identity is mirrored into the content area), Chrome should
805 // response and let Chrome handle the action with native UI. The only 805 // append a X-Chrome-Connected header to all Gaia requests from a connected
806 // exception is requests from gaia webview, since the native profile 806 // profile so Gaia could return a 204 response and let Chrome handle the
807 // management UI is built on top of it. 807 // action with native UI. The only exception is requests from gaia webview,
808 signin::AppendMirrorRequestHeaderHelper( 808 // since the native profile management UI is built on top of it.
809 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); 809 signin::FixMirrorRequestHeaderHelper(request, redirect_url, io_data,
810 info->GetChildID(), info->GetRouteID());
810 811
811 if (io_data->resource_prefetch_predictor_observer()) { 812 if (io_data->resource_prefetch_predictor_observer()) {
812 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( 813 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected(
813 redirect_url, request); 814 redirect_url, request);
814 } 815 }
815 816
816 if (io_data->policy_header_helper()) 817 if (io_data->policy_header_helper())
817 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); 818 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request);
818 } 819 }
819 820
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 891 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
891 base::Unretained(this), url, request_loading_time)); 892 base::Unretained(this), url, request_loading_time));
892 return; 893 return;
893 } 894 }
894 895
895 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 896 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
896 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 897 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
897 rappor::SampleDomainAndRegistryFromGURL( 898 rappor::SampleDomainAndRegistryFromGURL(
898 g_browser_process->rappor_service(), metric_name, url); 899 g_browser_process->rappor_service(), metric_name, url);
899 } 900 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698