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

Side by Side Diff: components/data_reduction_proxy/content/browser/content_lofi_decider.cc

Issue 2073233002: Do not trigger Lo-Fi on main frame requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed megjablon comments Created 4 years, 6 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_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/data_reduction_proxy/content/browser/content_lofi_decider.h " 5 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h "
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h" 9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h"
10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 std::string header_value; 60 std::string header_value;
61 61
62 if (headers->HasHeader(chrome_proxy_header())) { 62 if (headers->HasHeader(chrome_proxy_header())) {
63 headers->GetHeader(chrome_proxy_header(), &header_value); 63 headers->GetHeader(chrome_proxy_header(), &header_value);
64 headers->RemoveHeader(chrome_proxy_header()); 64 headers->RemoveHeader(chrome_proxy_header());
65 header_value += ", "; 65 header_value += ", ";
66 } 66 }
67 67
68 // If in the preview field trial or the preview flag is enabled, only add the 68 // If in the preview field trial or the preview flag is enabled, only add the
69 // "q=preview" directive on main frame requests. Do not add Lo-Fi directives 69 // "q=preview" directive on main frame requests. Do not add Lo-Fi directives
70 // to other requests when previews are enabled. If previews are not enabled, 70 // to other requests when previews are enabled.
71 // add "q=low".
72 if (lofi_preview_via_flag_or_field_trial) { 71 if (lofi_preview_via_flag_or_field_trial) {
73 if (request.load_flags() & net::LOAD_MAIN_FRAME) { 72 if (request.load_flags() & net::LOAD_MAIN_FRAME) {
74 if (params::AreLoFiPreviewsEnabledViaFlags()) { 73 if (params::AreLoFiPreviewsEnabledViaFlags()) {
75 header_value += chrome_proxy_lo_fi_ignore_preview_blacklist_directive(); 74 header_value += chrome_proxy_lo_fi_ignore_preview_blacklist_directive();
76 header_value += ", "; 75 header_value += ", ";
77 } 76 }
78 header_value += chrome_proxy_lo_fi_preview_directive(); 77 header_value += chrome_proxy_lo_fi_preview_directive();
79 } 78 }
80 } else { 79 } else if (!(request.load_flags() & net::LOAD_MAIN_FRAME)) {
80 // If previews are not enabled, add "q=low" for main frame requests.
megjablon 2016/06/22 20:56:29 If previews are not enabled, add "q=low" for reque
tbansal1 2016/06/22 21:41:02 Done.
81 header_value += chrome_proxy_lo_fi_directive(); 81 header_value += chrome_proxy_lo_fi_directive();
82 } 82 }
83 83
84 // |header_value| may be empty because the Lo-Fi directive is not added
85 // to subrequests when preview mode is enabled.
86 if (!header_value.empty()) 84 if (!header_value.empty())
87 headers->SetHeader(chrome_proxy_header(), header_value); 85 headers->SetHeader(chrome_proxy_header(), header_value);
88 86
89 return true; 87 return true;
90 } 88 }
91 89
92 } // namespace data_reduction_proxy 90 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698