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

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: fix ContentResourceProviderTest Created 3 years, 11 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/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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 BrowserThread::PostTask( 833 BrowserThread::PostTask(
834 BrowserThread::UI, FROM_HERE, 834 BrowserThread::UI, FROM_HERE,
835 base::Bind(&NotifyUIThreadOfRequestComplete, 835 base::Bind(&NotifyUIThreadOfRequestComplete,
836 info->GetWebContentsGetterForRequest(), url_request->url(), 836 info->GetWebContentsGetterForRequest(), url_request->url(),
837 info->GetResourceType(), url_request->was_cached(), net_error, 837 info->GetResourceType(), url_request->was_cached(), net_error,
838 url_request->GetTotalReceivedBytes(), 838 url_request->GetTotalReceivedBytes(),
839 url_request->GetRawBodyBytes(), url_request->creation_time(), 839 url_request->GetRawBodyBytes(), url_request->creation_time(),
840 base::TimeTicks::Now() - url_request->creation_time())); 840 base::TimeTicks::Now() - url_request->creation_time()));
841 } 841 }
842 842
843 bool ChromeResourceDispatcherHostDelegate::ShouldEnableLoFiMode( 843 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState(
844 const net::URLRequest& url_request, 844 const net::URLRequest& url_request,
845 content::ResourceContext* resource_context) { 845 content::ResourceContext* resource_context) {
846 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 846 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
847 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = 847 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data =
848 io_data->data_reduction_proxy_io_data(); 848 io_data->data_reduction_proxy_io_data();
849 849
850 if (data_reduction_proxy_io_data) 850 if (data_reduction_proxy_io_data) {
851 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); 851 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request)
852 return false; 852 ? content::SERVER_LOFI_ON
853 : content::PREVIEWS_OFF;
854 }
855 return content::PREVIEWS_OFF;
853 } 856 }
854 857
855 // static 858 // static
856 void ChromeResourceDispatcherHostDelegate:: 859 void ChromeResourceDispatcherHostDelegate::
857 SetExternalProtocolHandlerDelegateForTesting( 860 SetExternalProtocolHandlerDelegateForTesting(
858 ExternalProtocolHandler::Delegate* delegate) { 861 ExternalProtocolHandler::Delegate* delegate) {
859 g_external_protocol_handler_delegate = delegate; 862 g_external_protocol_handler_delegate = delegate;
860 } 863 }
861 864
862 content::NavigationData* 865 content::NavigationData*
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 899 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
897 base::Unretained(this), url, request_loading_time)); 900 base::Unretained(this), url, request_loading_time));
898 return; 901 return;
899 } 902 }
900 903
901 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 904 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
902 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 905 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
903 rappor::SampleDomainAndRegistryFromGURL( 906 rappor::SampleDomainAndRegistryFromGURL(
904 g_browser_process->rappor_service(), metric_name, url); 907 g_browser_process->rappor_service(), metric_name, url);
905 } 908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698