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

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

Issue 2848293002: Adding the Previews infobar to pages that show a client LoFi image (Closed)
Patch Set: sclittle comments Created 3 years, 7 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 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 "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (!request_info || 205 if (!request_info ||
206 !(request_info->GetPreviewsState() & content::SERVER_LOFI_ON || 206 !(request_info->GetPreviewsState() & content::SERVER_LOFI_ON ||
207 request_info->GetPreviewsState() & content::SERVER_LITE_PAGE_ON)) { 207 request_info->GetPreviewsState() & content::SERVER_LITE_PAGE_ON)) {
208 return false; 208 return false;
209 } 209 }
210 210
211 return params::IsIncludedInLoFiEnabledFieldTrial() || 211 return params::IsIncludedInLoFiEnabledFieldTrial() ||
212 params::IsIncludedInLoFiControlFieldTrial(); 212 params::IsIncludedInLoFiControlFieldTrial();
213 } 213 }
214 214
215 bool ContentLoFiDecider::IsClientLoFiImageRequest(
216 const net::URLRequest& request) const {
217 const content::ResourceRequestInfo* request_info =
218 content::ResourceRequestInfo::ForRequest(&request);
219 return request_info &&
220 request_info->GetResourceType() == content::RESOURCE_TYPE_IMAGE &&
221 request_info->GetPreviewsState() & content::CLIENT_LOFI_ON;
sclittle 2017/05/03 22:51:29 style nit: could you put parentheses around the bi
RyanSturm 2017/05/03 23:20:29 Done.
222 }
223
215 } // namespace data_reduction_proxy 224 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698