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

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

Powered by Google App Engine
This is Rietveld 408576698