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/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 ResourceRequestInfo::ForRequest(url_request); | 822 ResourceRequestInfo::ForRequest(url_request); |
823 BrowserThread::PostTask( | 823 BrowserThread::PostTask( |
824 BrowserThread::UI, FROM_HERE, | 824 BrowserThread::UI, FROM_HERE, |
825 base::Bind(&NotifyUIThreadOfRequestComplete, | 825 base::Bind(&NotifyUIThreadOfRequestComplete, |
826 info->GetWebContentsGetterForRequest(), url_request->url(), | 826 info->GetWebContentsGetterForRequest(), url_request->url(), |
827 info->GetResourceType(), url_request->was_cached(), net_error, | 827 info->GetResourceType(), url_request->was_cached(), net_error, |
828 url_request->GetTotalReceivedBytes(), | 828 url_request->GetTotalReceivedBytes(), |
829 base::TimeTicks::Now() - url_request->creation_time())); | 829 base::TimeTicks::Now() - url_request->creation_time())); |
830 } | 830 } |
831 | 831 |
832 bool ChromeResourceDispatcherHostDelegate::ShouldEnableLoFiMode( | 832 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( |
833 const net::URLRequest& url_request, | 833 const net::URLRequest& url_request, |
834 content::ResourceContext* resource_context) { | 834 content::ResourceContext* resource_context) { |
835 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 835 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
836 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = | 836 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = |
837 io_data->data_reduction_proxy_io_data(); | 837 io_data->data_reduction_proxy_io_data(); |
838 | 838 |
839 if (data_reduction_proxy_io_data) | 839 if (data_reduction_proxy_io_data) { |
840 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); | 840 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request) |
841 return false; | 841 ? content::SERVER_LOFI_ON |
| 842 : content::PREVIEWS_OFF; |
| 843 } |
| 844 return content::PREVIEWS_OFF; |
842 } | 845 } |
843 | 846 |
844 // static | 847 // static |
845 void ChromeResourceDispatcherHostDelegate:: | 848 void ChromeResourceDispatcherHostDelegate:: |
846 SetExternalProtocolHandlerDelegateForTesting( | 849 SetExternalProtocolHandlerDelegateForTesting( |
847 ExternalProtocolHandler::Delegate* delegate) { | 850 ExternalProtocolHandler::Delegate* delegate) { |
848 g_external_protocol_handler_delegate = delegate; | 851 g_external_protocol_handler_delegate = delegate; |
849 } | 852 } |
850 | 853 |
851 content::NavigationData* | 854 content::NavigationData* |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 888 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
886 base::Unretained(this), url, request_loading_time)); | 889 base::Unretained(this), url, request_loading_time)); |
887 return; | 890 return; |
888 } | 891 } |
889 | 892 |
890 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 893 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
891 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 894 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
892 rappor::SampleDomainAndRegistryFromGURL( | 895 rappor::SampleDomainAndRegistryFromGURL( |
893 g_browser_process->rappor_service(), metric_name, url); | 896 g_browser_process->rappor_service(), metric_name, url); |
894 } | 897 } |
OLD | NEW |