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

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

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: rebase Created 4 years 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/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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 ResourceRequestInfo::ForRequest(url_request); 825 ResourceRequestInfo::ForRequest(url_request);
826 BrowserThread::PostTask( 826 BrowserThread::PostTask(
827 BrowserThread::UI, FROM_HERE, 827 BrowserThread::UI, FROM_HERE,
828 base::Bind(&NotifyUIThreadOfRequestComplete, 828 base::Bind(&NotifyUIThreadOfRequestComplete,
829 info->GetWebContentsGetterForRequest(), url_request->url(), 829 info->GetWebContentsGetterForRequest(), url_request->url(),
830 info->GetResourceType(), url_request->was_cached(), net_error, 830 info->GetResourceType(), url_request->was_cached(), net_error,
831 url_request->GetTotalReceivedBytes(), 831 url_request->GetTotalReceivedBytes(),
832 base::TimeTicks::Now() - url_request->creation_time())); 832 base::TimeTicks::Now() - url_request->creation_time()));
833 } 833 }
834 834
835 bool ChromeResourceDispatcherHostDelegate::ShouldEnableLoFiMode( 835 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState(
836 const net::URLRequest& url_request, 836 const net::URLRequest& url_request,
837 content::ResourceContext* resource_context) { 837 content::ResourceContext* resource_context) {
838 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 838 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
839 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = 839 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data =
840 io_data->data_reduction_proxy_io_data(); 840 io_data->data_reduction_proxy_io_data();
841 841
842 if (data_reduction_proxy_io_data) 842 if (data_reduction_proxy_io_data) {
843 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); 843 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request)
844 return false; 844 ? content::SERVER_LOFI_ON
845 : content::PREVIEWS_OFF;
846 }
847 return content::PREVIEWS_OFF;
845 } 848 }
846 849
847 // static 850 // static
848 void ChromeResourceDispatcherHostDelegate:: 851 void ChromeResourceDispatcherHostDelegate::
849 SetExternalProtocolHandlerDelegateForTesting( 852 SetExternalProtocolHandlerDelegateForTesting(
850 ExternalProtocolHandler::Delegate* delegate) { 853 ExternalProtocolHandler::Delegate* delegate) {
851 g_external_protocol_handler_delegate = delegate; 854 g_external_protocol_handler_delegate = delegate;
852 } 855 }
853 856
854 content::NavigationData* 857 content::NavigationData*
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 891 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
889 base::Unretained(this), url, request_loading_time)); 892 base::Unretained(this), url, request_loading_time));
890 return; 893 return;
891 } 894 }
892 895
893 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 896 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
894 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 897 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
895 rappor::SampleDomainAndRegistryFromGURL( 898 rappor::SampleDomainAndRegistryFromGURL(
896 g_browser_process->rappor_service(), metric_name, url); 899 g_browser_process->rappor_service(), metric_name, url);
897 } 900 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698