OLD | NEW |
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 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" | 26 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" |
27 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 27 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
28 #include "chrome/browser/prerender/prerender_tracker.h" | 28 #include "chrome/browser/prerender/prerender_tracker.h" |
29 #include "chrome/browser/prerender/prerender_util.h" | 29 #include "chrome/browser/prerender/prerender_util.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/profiles/profile_io_data.h" | 31 #include "chrome/browser/profiles/profile_io_data.h" |
32 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" | 32 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" |
33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
34 #include "chrome/browser/signin/signin_header_helper.h" | 34 #include "chrome/browser/signin/signin_header_helper.h" |
35 #include "chrome/browser/tab_contents/tab_util.h" | 35 #include "chrome/browser/tab_contents/tab_util.h" |
36 #include "chrome/browser/ui/auto_login_prompter.h" | |
37 #include "chrome/browser/ui/login/login_prompt.h" | 36 #include "chrome/browser/ui/login/login_prompt.h" |
38 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 37 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
39 #include "chrome/common/extensions/extension_constants.h" | 38 #include "chrome/common/extensions/extension_constants.h" |
40 #include "chrome/common/extensions/mime_types_handler.h" | 39 #include "chrome/common/extensions/mime_types_handler.h" |
41 #include "chrome/common/render_messages.h" | 40 #include "chrome/common/render_messages.h" |
42 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
43 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
44 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
45 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
46 #include "content/public/browser/render_view_host.h" | 45 #include "content/public/browser/render_view_host.h" |
(...skipping 21 matching lines...) Expand all Loading... |
68 #endif | 67 #endif |
69 | 68 |
70 #if defined(USE_SYSTEM_PROTOBUF) | 69 #if defined(USE_SYSTEM_PROTOBUF) |
71 #include <google/protobuf/repeated_field.h> | 70 #include <google/protobuf/repeated_field.h> |
72 #else | 71 #else |
73 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 72 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
74 #endif | 73 #endif |
75 | 74 |
76 #if defined(OS_ANDROID) | 75 #if defined(OS_ANDROID) |
77 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 76 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| 77 #include "chrome/browser/ui/android/infobars/auto_login_prompter.h" |
78 #include "components/navigation_interception/intercept_navigation_delegate.h" | 78 #include "components/navigation_interception/intercept_navigation_delegate.h" |
79 #else | 79 #else |
80 #include "chrome/browser/apps/app_url_redirector.h" | 80 #include "chrome/browser/apps/app_url_redirector.h" |
81 #include "chrome/browser/apps/ephemeral_app_throttle.h" | 81 #include "chrome/browser/apps/ephemeral_app_throttle.h" |
82 #endif | 82 #endif |
83 | 83 |
84 #if defined(OS_CHROMEOS) | 84 #if defined(OS_CHROMEOS) |
85 #include "chrome/browser/chromeos/login/merge_session_throttle.h" | 85 #include "chrome/browser/chromeos/login/merge_session_throttle.h" |
86 // TODO(oshima): Enable this for other platforms. | 86 // TODO(oshima): Enable this for other platforms. |
87 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 87 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 #endif | 593 #endif |
594 } | 594 } |
595 | 595 |
596 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( | 596 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( |
597 net::URLRequest* request, | 597 net::URLRequest* request, |
598 content::ResourceContext* resource_context, | 598 content::ResourceContext* resource_context, |
599 content::ResourceResponse* response, | 599 content::ResourceResponse* response, |
600 IPC::Sender* sender) { | 600 IPC::Sender* sender) { |
601 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 601 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
602 | 602 |
| 603 #if defined(OS_ANDROID) |
603 // See if the response contains the X-Auto-Login header. If so, this was | 604 // See if the response contains the X-Auto-Login header. If so, this was |
604 // a request for a login page, and the server is allowing the browser to | 605 // a request for a login page, and the server is allowing the browser to |
605 // suggest auto-login, if available. | 606 // suggest auto-login, if available. |
606 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(), | 607 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(), |
607 info->GetRouteID()); | 608 info->GetRouteID()); |
| 609 #endif |
608 | 610 |
609 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 611 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
610 | 612 |
611 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 613 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
612 // See if the response contains the Google-Accounts-SignIn header. If so, | 614 // See if the response contains the Google-Accounts-SignIn header. If so, |
613 // then the user has just finished signing in, and the server is allowing the | 615 // then the user has just finished signing in, and the server is allowing the |
614 // browser to suggest connecting the user's profile to the account. | 616 // browser to suggest connecting the user's profile to the account. |
615 OneClickSigninHelper::ShowInfoBarIfPossible(request, io_data, | 617 OneClickSigninHelper::ShowInfoBarIfPossible(request, io_data, |
616 info->GetChildID(), | 618 info->GetChildID(), |
617 info->GetRouteID()); | 619 info->GetRouteID()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 url_request->GetTotalReceivedBytes())); | 696 url_request->GetTotalReceivedBytes())); |
695 } | 697 } |
696 } | 698 } |
697 | 699 |
698 // static | 700 // static |
699 void ChromeResourceDispatcherHostDelegate:: | 701 void ChromeResourceDispatcherHostDelegate:: |
700 SetExternalProtocolHandlerDelegateForTesting( | 702 SetExternalProtocolHandlerDelegateForTesting( |
701 ExternalProtocolHandler::Delegate* delegate) { | 703 ExternalProtocolHandler::Delegate* delegate) { |
702 g_external_protocol_handler_delegate = delegate; | 704 g_external_protocol_handler_delegate = delegate; |
703 } | 705 } |
OLD | NEW |