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

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

Issue 914363003: Remove OneClickSigninHelper since it is no longer used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocl
Patch Set: rebased Created 5 years, 9 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "extensions/common/constants.h" 72 #include "extensions/common/constants.h"
73 #include "extensions/common/extension_urls.h" 73 #include "extensions/common/extension_urls.h"
74 #include "extensions/common/manifest_handlers/mime_types_handler.h" 74 #include "extensions/common/manifest_handlers/mime_types_handler.h"
75 #include "extensions/common/user_script.h" 75 #include "extensions/common/user_script.h"
76 #endif 76 #endif
77 77
78 #if defined(ENABLE_SUPERVISED_USERS) 78 #if defined(ENABLE_SUPERVISED_USERS)
79 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" 79 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h"
80 #endif 80 #endif
81 81
82 #if defined(ENABLE_ONE_CLICK_SIGNIN)
83 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
84 #endif
85
86 #if defined(USE_SYSTEM_PROTOBUF) 82 #if defined(USE_SYSTEM_PROTOBUF)
87 #include <google/protobuf/repeated_field.h> 83 #include <google/protobuf/repeated_field.h>
88 #else 84 #else
89 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 85 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
90 #endif 86 #endif
91 87
92 #if defined(OS_ANDROID) 88 #if defined(OS_ANDROID)
93 #include "chrome/browser/android/intercept_download_resource_throttle.h" 89 #include "chrome/browser/android/intercept_download_resource_throttle.h"
94 #include "components/navigation_interception/intercept_navigation_delegate.h" 90 #include "components/navigation_interception/intercept_navigation_delegate.h"
95 #endif 91 #endif
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 bool is_off_the_record = io_data->IsOffTheRecord(); 428 bool is_off_the_record = io_data->IsOffTheRecord();
433 variations::VariationsHttpHeaderProvider::GetInstance()-> 429 variations::VariationsHttpHeaderProvider::GetInstance()->
434 AppendHeaders(request->url(), 430 AppendHeaders(request->url(),
435 is_off_the_record, 431 is_off_the_record,
436 !is_off_the_record && 432 !is_off_the_record &&
437 io_data->GetMetricsEnabledStateOnIOThread(), 433 io_data->GetMetricsEnabledStateOnIOThread(),
438 &headers); 434 &headers);
439 request->SetExtraRequestHeaders(headers); 435 request->SetExtraRequestHeaders(headers);
440 } 436 }
441 437
442 #if defined(ENABLE_ONE_CLICK_SIGNIN)
443 AppendChromeSyncGaiaHeader(request, resource_context);
444 #endif
445
446 #if defined(ENABLE_CONFIGURATION_POLICY) 438 #if defined(ENABLE_CONFIGURATION_POLICY)
447 if (io_data->policy_header_helper()) 439 if (io_data->policy_header_helper())
448 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); 440 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request);
449 #endif 441 #endif
450 442
451 signin::AppendMirrorRequestHeaderIfPossible( 443 signin::AppendMirrorRequestHeaderIfPossible(
452 request, GURL() /* redirect_url */, io_data, 444 request, GURL() /* redirect_url */, io_data,
453 info->GetChildID(), info->GetRouteID()); 445 info->GetChildID(), info->GetRouteID());
454 446
455 AppendStandardResourceThrottles(request, 447 AppendStandardResourceThrottles(request,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (throttle) 578 if (throttle)
587 throttles->push_back(throttle); 579 throttles->push_back(throttle);
588 #endif 580 #endif
589 581
590 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 582 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
591 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { 583 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) {
592 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); 584 throttles->push_back(new prerender::PrerenderResourceThrottle(request));
593 } 585 }
594 } 586 }
595 587
596 #if defined(ENABLE_ONE_CLICK_SIGNIN)
597 void ChromeResourceDispatcherHostDelegate::AppendChromeSyncGaiaHeader(
598 net::URLRequest* request,
599 content::ResourceContext* resource_context) {
600 static const char kAllowChromeSignIn[] = "Allow-Chrome-SignIn";
601
602 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
603 OneClickSigninHelper::Offer offer =
604 OneClickSigninHelper::CanOfferOnIOThread(request, io_data);
605 switch (offer) {
606 case OneClickSigninHelper::CAN_OFFER:
607 request->SetExtraRequestHeaderByName(kAllowChromeSignIn, "1", false);
608 break;
609 case OneClickSigninHelper::DONT_OFFER:
610 request->RemoveRequestHeaderByName(kAllowChromeSignIn);
611 break;
612 case OneClickSigninHelper::IGNORE_REQUEST:
613 break;
614 }
615 }
616 #endif
617
618 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( 588 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource(
619 const GURL& url, const std::string& mime_type) { 589 const GURL& url, const std::string& mime_type) {
620 #if defined(ENABLE_EXTENSIONS) 590 #if defined(ENABLE_EXTENSIONS)
621 // Special-case user scripts to get downloaded instead of viewed. 591 // Special-case user scripts to get downloaded instead of viewed.
622 return extensions::UserScript::IsURLUserScript(url, mime_type); 592 return extensions::UserScript::IsURLUserScript(url, mime_type);
623 #else 593 #else
624 return false; 594 return false;
625 #endif 595 #endif
626 } 596 }
627 597
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } 666 }
697 667
698 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( 668 void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
699 net::URLRequest* request, 669 net::URLRequest* request,
700 content::ResourceContext* resource_context, 670 content::ResourceContext* resource_context,
701 content::ResourceResponse* response, 671 content::ResourceResponse* response,
702 IPC::Sender* sender) { 672 IPC::Sender* sender) {
703 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 673 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
704 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 674 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
705 675
706 #if defined(ENABLE_ONE_CLICK_SIGNIN)
707 // See if the response contains the Google-Accounts-SignIn header. If so,
708 // then the user has just finished signing in, and the server is allowing the
709 // browser to suggest connecting the user's profile to the account.
710 OneClickSigninHelper::ShowInfoBarIfPossible(request, io_data,
711 info->GetChildID(),
712 info->GetRouteID());
713 #endif
714
715 // See if the response contains the X-Chrome-Manage-Accounts header. If so 676 // See if the response contains the X-Chrome-Manage-Accounts header. If so
716 // show the profile avatar bubble so that user can complete signin/out action 677 // show the profile avatar bubble so that user can complete signin/out action
717 // the native UI. 678 // the native UI.
718 signin::ProcessMirrorResponseHeaderIfExists(request, io_data, 679 signin::ProcessMirrorResponseHeaderIfExists(request, io_data,
719 info->GetChildID(), 680 info->GetChildID(),
720 info->GetRouteID()); 681 info->GetRouteID());
721 682
722 // Build in additional protection for the chrome web store origin. 683 // Build in additional protection for the chrome web store origin.
723 #if defined(ENABLE_EXTENSIONS) 684 #if defined(ENABLE_EXTENSIONS)
724 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); 685 GURL webstore_url(extension_urls::GetWebstoreLaunchURL());
(...skipping 29 matching lines...) Expand all
754 715
755 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( 716 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
756 const GURL& redirect_url, 717 const GURL& redirect_url,
757 net::URLRequest* request, 718 net::URLRequest* request,
758 content::ResourceContext* resource_context, 719 content::ResourceContext* resource_context,
759 content::ResourceResponse* response) { 720 content::ResourceResponse* response) {
760 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 721 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
761 722
762 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 723 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
763 724
764 #if defined(ENABLE_ONE_CLICK_SIGNIN)
765 // See if the response contains the Google-Accounts-SignIn header. If so,
766 // then the user has just finished signing in, and the server is allowing the
767 // browser to suggest connecting the user's profile to the account.
768 OneClickSigninHelper::ShowInfoBarIfPossible(request, io_data,
769 info->GetChildID(),
770 info->GetRouteID());
771 AppendChromeSyncGaiaHeader(request, resource_context);
772 #endif
773
774 // In the Mirror world, Chrome should append a X-Chrome-Connected header to 725 // In the Mirror world, Chrome should append a X-Chrome-Connected header to
775 // all Gaia requests from a connected profile so Gaia could return a 204 726 // all Gaia requests from a connected profile so Gaia could return a 204
776 // response and let Chrome handle the action with native UI. The only 727 // response and let Chrome handle the action with native UI. The only
777 // exception is requests from gaia webview, since the native profile 728 // exception is requests from gaia webview, since the native profile
778 // management UI is built on top of it. 729 // management UI is built on top of it.
779 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, 730 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data,
780 info->GetChildID(), info->GetRouteID()); 731 info->GetChildID(), info->GetRouteID());
781 732
782 if (io_data->resource_prefetch_predictor_observer()) { 733 if (io_data->resource_prefetch_predictor_observer()) {
783 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( 734 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected(
(...skipping 21 matching lines...) Expand all
805 url_request->GetTotalReceivedBytes())); 756 url_request->GetTotalReceivedBytes()));
806 } 757 }
807 } 758 }
808 759
809 // static 760 // static
810 void ChromeResourceDispatcherHostDelegate:: 761 void ChromeResourceDispatcherHostDelegate::
811 SetExternalProtocolHandlerDelegateForTesting( 762 SetExternalProtocolHandlerDelegateForTesting(
812 ExternalProtocolHandler::Delegate* delegate) { 763 ExternalProtocolHandler::Delegate* delegate) {
813 g_external_protocol_handler_delegate = delegate; 764 g_external_protocol_handler_delegate = delegate;
814 } 765 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698