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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2800473002: Treat responses with legacy LoFi headers as LoFi images. (Closed)
Patch Set: Added comment describing CPCT header format Created 3 years, 8 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/core/common/data_reduction_proxy_headers.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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 RenderThread::Get()->GetConnector()->BindInterface( 1377 RenderThread::Get()->GetConnector()->BindInterface(
1378 content::mojom::kBrowserServiceName, &rappor_recorder_); 1378 content::mojom::kBrowserServiceName, &rappor_recorder_);
1379 } 1379 }
1380 rappor_recorder_->RecordRapporURL(metric, url); 1380 rappor_recorder_->RecordRapporURL(metric, url);
1381 } 1381 }
1382 1382
1383 void ChromeContentRendererClient::AddImageContextMenuProperties( 1383 void ChromeContentRendererClient::AddImageContextMenuProperties(
1384 const WebURLResponse& response, 1384 const WebURLResponse& response,
1385 std::map<std::string, std::string>* properties) { 1385 std::map<std::string, std::string>* properties) {
1386 DCHECK(properties); 1386 DCHECK(properties);
1387 WebString header_key(WebString::fromASCII( 1387
1388 WebString cpct_value = response.httpHeaderField(WebString::fromASCII(
Lei Zhang 2017/04/08 01:01:07 Why do we have to go from const char* to WebString
sclittle 2017/04/10 20:56:50 We basically want to call: drp::IsEmptyImagePrevi
1388 data_reduction_proxy::chrome_proxy_content_transform_header())); 1389 data_reduction_proxy::chrome_proxy_content_transform_header()));
1389 if (!response.httpHeaderField(header_key).isNull() && 1390 WebString chrome_proxy_value = response.httpHeaderField(
1390 data_reduction_proxy::IsEmptyImagePreview( 1391 WebString::fromASCII(data_reduction_proxy::chrome_proxy_header()));
1391 response.httpHeaderField(header_key).utf8())) { 1392
1392 (*properties)[ 1393 if (data_reduction_proxy::IsEmptyImagePreview(cpct_value.utf8(),
1393 data_reduction_proxy::chrome_proxy_content_transform_header()] = 1394 chrome_proxy_value.utf8())) {
1395 (*properties)
1396 [data_reduction_proxy::chrome_proxy_content_transform_header()] =
1394 data_reduction_proxy::empty_image_directive(); 1397 data_reduction_proxy::empty_image_directive();
1395 } 1398 }
1396 } 1399 }
1397 1400
1398 void ChromeContentRendererClient::RunScriptsAtDocumentStart( 1401 void ChromeContentRendererClient::RunScriptsAtDocumentStart(
1399 content::RenderFrame* render_frame) { 1402 content::RenderFrame* render_frame) {
1400 #if BUILDFLAG(ENABLE_EXTENSIONS) 1403 #if BUILDFLAG(ENABLE_EXTENSIONS)
1401 ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentStart( 1404 ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentStart(
1402 render_frame); 1405 render_frame);
1403 // |render_frame| might be dead by now. 1406 // |render_frame| might be dead by now.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 1522
1520 RecordYouTubeRewriteUMA(result); 1523 RecordYouTubeRewriteUMA(result);
1521 return corrected_url.ReplaceComponents(r); 1524 return corrected_url.ReplaceComponents(r);
1522 } 1525 }
1523 1526
1524 std::unique_ptr<base::TaskScheduler::InitParams> 1527 std::unique_ptr<base::TaskScheduler::InitParams>
1525 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1528 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1526 return task_scheduler_util:: 1529 return task_scheduler_util::
1527 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1530 GetRendererTaskSchedulerInitParamsFromCommandLine();
1528 } 1531 }
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698