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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/prerender/prerender_tracker.h" | 24 #include "chrome/browser/prerender/prerender_tracker.h" |
25 #include "chrome/browser/prerender/prerender_util.h" | 25 #include "chrome/browser/prerender/prerender_util.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/profiles/profile_io_data.h" | 27 #include "chrome/browser/profiles/profile_io_data.h" |
28 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" | 28 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" |
29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
30 #include "chrome/browser/signin/signin_header_helper.h" | 30 #include "chrome/browser/signin/signin_header_helper.h" |
31 #include "chrome/browser/tab_contents/tab_util.h" | 31 #include "chrome/browser/tab_contents/tab_util.h" |
32 #include "chrome/browser/ui/login/login_prompt.h" | 32 #include "chrome/browser/ui/login/login_prompt.h" |
33 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 33 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
34 #include "chrome/common/extensions/extension_constants.h" | |
35 #include "chrome/common/render_messages.h" | 34 #include "chrome/common/render_messages.h" |
36 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
37 #include "components/google/core/browser/google_util.h" | 36 #include "components/google/core/browser/google_util.h" |
38 #include "components/variations/variations_http_header_provider.h" | 37 #include "components/variations/variations_http_header_provider.h" |
39 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
41 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
42 #include "content/public/browser/render_view_host.h" | 41 #include "content/public/browser/render_view_host.h" |
43 #include "content/public/browser/resource_context.h" | 42 #include "content/public/browser/resource_context.h" |
44 #include "content/public/browser/resource_dispatcher_host.h" | 43 #include "content/public/browser/resource_dispatcher_host.h" |
(...skipping 17 matching lines...) Expand all Loading... |
62 | 61 |
63 #if defined(ENABLE_EXTENSIONS) | 62 #if defined(ENABLE_EXTENSIONS) |
64 #include "chrome/browser/apps/app_url_redirector.h" | 63 #include "chrome/browser/apps/app_url_redirector.h" |
65 #include "chrome/browser/apps/ephemeral_app_throttle.h" | 64 #include "chrome/browser/apps/ephemeral_app_throttle.h" |
66 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" | 65 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
67 #include "chrome/browser/extensions/user_script_listener.h" | 66 #include "chrome/browser/extensions/user_script_listener.h" |
68 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" | 67 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" |
69 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 68 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
70 #include "extensions/browser/info_map.h" | 69 #include "extensions/browser/info_map.h" |
71 #include "extensions/common/constants.h" | 70 #include "extensions/common/constants.h" |
| 71 #include "extensions/common/extension_urls.h" |
72 #include "extensions/common/user_script.h" | 72 #include "extensions/common/user_script.h" |
73 #endif | 73 #endif |
74 | 74 |
75 #if defined(ENABLE_MANAGED_USERS) | 75 #if defined(ENABLE_MANAGED_USERS) |
76 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" | 76 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" |
77 #endif | 77 #endif |
78 | 78 |
79 #if defined(USE_SYSTEM_PROTOBUF) | 79 #if defined(USE_SYSTEM_PROTOBUF) |
80 #include <google/protobuf/repeated_field.h> | 80 #include <google/protobuf/repeated_field.h> |
81 #else | 81 #else |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 #endif | 654 #endif |
655 | 655 |
656 // See if the response contains the X-Chrome-Manage-Accounts header. If so | 656 // See if the response contains the X-Chrome-Manage-Accounts header. If so |
657 // show the profile avatar bubble so that user can complete signin/out action | 657 // show the profile avatar bubble so that user can complete signin/out action |
658 // the native UI. | 658 // the native UI. |
659 signin::ProcessMirrorResponseHeaderIfExists(request, io_data, | 659 signin::ProcessMirrorResponseHeaderIfExists(request, io_data, |
660 info->GetChildID(), | 660 info->GetChildID(), |
661 info->GetRouteID()); | 661 info->GetRouteID()); |
662 | 662 |
663 // Build in additional protection for the chrome web store origin. | 663 // Build in additional protection for the chrome web store origin. |
| 664 #if defined(ENABLE_EXTENSIONS) |
664 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); | 665 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); |
665 if (request->url().DomainIs(webstore_url.host().c_str())) { | 666 if (request->url().DomainIs(webstore_url.host().c_str())) { |
666 net::HttpResponseHeaders* response_headers = request->response_headers(); | 667 net::HttpResponseHeaders* response_headers = request->response_headers(); |
667 if (!response_headers->HasHeaderValue("x-frame-options", "deny") && | 668 if (!response_headers->HasHeaderValue("x-frame-options", "deny") && |
668 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { | 669 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { |
669 response_headers->RemoveHeader("x-frame-options"); | 670 response_headers->RemoveHeader("x-frame-options"); |
670 response_headers->AddHeader("x-frame-options: sameorigin"); | 671 response_headers->AddHeader("x-frame-options: sameorigin"); |
671 } | 672 } |
672 } | 673 } |
| 674 #endif |
673 | 675 |
674 // Ignores x-frame-options for the chrome signin UI. | 676 // Ignores x-frame-options for the chrome signin UI. |
675 const std::string request_spec( | 677 const std::string request_spec( |
676 request->first_party_for_cookies().GetOrigin().spec()); | 678 request->first_party_for_cookies().GetOrigin().spec()); |
677 #if defined(OS_CHROMEOS) | 679 #if defined(OS_CHROMEOS) |
678 if (request_spec == chrome::kChromeUIOobeURL || | 680 if (request_spec == chrome::kChromeUIOobeURL || |
679 request_spec == chrome::kChromeUIChromeSigninURL) { | 681 request_spec == chrome::kChromeUIChromeSigninURL) { |
680 #else | 682 #else |
681 if (request_spec == chrome::kChromeUIChromeSigninURL) { | 683 if (request_spec == chrome::kChromeUIChromeSigninURL) { |
682 #endif | 684 #endif |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 url_request->GetTotalReceivedBytes())); | 737 url_request->GetTotalReceivedBytes())); |
736 } | 738 } |
737 } | 739 } |
738 | 740 |
739 // static | 741 // static |
740 void ChromeResourceDispatcherHostDelegate:: | 742 void ChromeResourceDispatcherHostDelegate:: |
741 SetExternalProtocolHandlerDelegateForTesting( | 743 SetExternalProtocolHandlerDelegateForTesting( |
742 ExternalProtocolHandler::Delegate* delegate) { | 744 ExternalProtocolHandler::Delegate* delegate) { |
743 g_external_protocol_handler_delegate = delegate; | 745 g_external_protocol_handler_delegate = delegate; |
744 } | 746 } |
OLD | NEW |