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

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

Issue 2642793005: Create a Lite Page bit for previews and fallback to Lo-Fi (Closed)
Patch Set: remove unused frame_messages.h code Created 3 years, 9 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
« no previous file with comments | « no previous file | components/data_reduction_proxy/content/browser/content_lofi_decider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 base::TimeTicks::Now() - url_request->creation_time())); 860 base::TimeTicks::Now() - url_request->creation_time()));
861 } 861 }
862 862
863 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( 863 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState(
864 const net::URLRequest& url_request, 864 const net::URLRequest& url_request,
865 content::ResourceContext* resource_context) { 865 content::ResourceContext* resource_context) {
866 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 866 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
867 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = 867 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data =
868 io_data->data_reduction_proxy_io_data(); 868 io_data->data_reduction_proxy_io_data();
869 869
870 content::PreviewsState previews_state = content::PREVIEWS_UNSPECIFIED;
871
870 if (data_reduction_proxy_io_data) { 872 if (data_reduction_proxy_io_data) {
871 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request) 873 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request))
872 ? content::SERVER_LOFI_ON 874 previews_state |= content::SERVER_LOFI_ON;
873 : content::PREVIEWS_OFF; 875 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request))
876 previews_state |= content::SERVER_LITE_PAGE_ON;
874 } 877 }
875 return content::PREVIEWS_OFF; 878
879 if (previews_state == content::PREVIEWS_UNSPECIFIED)
880 return content::PREVIEWS_OFF;
881 return previews_state;
876 } 882 }
877 883
878 // static 884 // static
879 void ChromeResourceDispatcherHostDelegate:: 885 void ChromeResourceDispatcherHostDelegate::
880 SetExternalProtocolHandlerDelegateForTesting( 886 SetExternalProtocolHandlerDelegateForTesting(
881 ExternalProtocolHandler::Delegate* delegate) { 887 ExternalProtocolHandler::Delegate* delegate) {
882 g_external_protocol_handler_delegate = delegate; 888 g_external_protocol_handler_delegate = delegate;
883 } 889 }
884 890
885 content::NavigationData* 891 content::NavigationData*
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 925 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
920 base::Unretained(this), url, request_loading_time)); 926 base::Unretained(this), url, request_loading_time));
921 return; 927 return;
922 } 928 }
923 929
924 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 930 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
925 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 931 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
926 rappor::SampleDomainAndRegistryFromGURL( 932 rappor::SampleDomainAndRegistryFromGURL(
927 g_browser_process->rappor_service(), metric_name, url); 933 g_browser_process->rappor_service(), metric_name, url);
928 } 934 }
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/content/browser/content_lofi_decider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698