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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 988453002: Request uncompressed images from data reduction proxy when saving. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head Created 5 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 | content/browser/web_contents/web_contents_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 IDS_CONTENT_CONTEXT_COPYLINKLOCATION); 688 IDS_CONTENT_CONTEXT_COPYLINKLOCATION);
689 } 689 }
690 690
691 void RenderViewContextMenu::AppendImageItems() { 691 void RenderViewContextMenu::AppendImageItems() {
692 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 692 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEIMAGEAS,
693 IDS_CONTENT_CONTEXT_SAVEIMAGEAS); 693 IDS_CONTENT_CONTEXT_SAVEIMAGEAS);
694 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGELOCATION, 694 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGELOCATION,
695 IDS_CONTENT_CONTEXT_COPYIMAGELOCATION); 695 IDS_CONTENT_CONTEXT_COPYIMAGELOCATION);
696 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE, 696 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE,
697 IDS_CONTENT_CONTEXT_COPYIMAGE); 697 IDS_CONTENT_CONTEXT_COPYIMAGE);
698 if (!browser_context_->IsOffTheRecord() && 698 DataReductionProxyChromeSettings* settings =
699 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 699 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
700 browser_context_)->CanUseDataReductionProxy(params_.src_url)) { 700 browser_context_);
701 if (settings && settings->CanUseDataReductionProxy(params_.src_url)) {
701 menu_model_.AddItemWithStringId( 702 menu_model_.AddItemWithStringId(
702 IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB, 703 IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB,
703 IDS_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB); 704 IDS_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB);
704 } else { 705 } else {
705 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB, 706 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB,
706 IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB); 707 IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB);
707 } 708 }
708 } 709 }
709 710
710 void RenderViewContextMenu::AppendSearchWebForImageItems() { 711 void RenderViewContextMenu::AppendSearchWebForImageItems() {
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 params_.src_url.is_empty(); 1384 params_.src_url.is_empty();
1384 if (params_.media_type == WebContextMenuData::MediaTypeCanvas || 1385 if (params_.media_type == WebContextMenuData::MediaTypeCanvas ||
1385 (params_.media_type == WebContextMenuData::MediaTypeImage && 1386 (params_.media_type == WebContextMenuData::MediaTypeImage &&
1386 is_large_data_url)) { 1387 is_large_data_url)) {
1387 source_web_contents_->GetRenderViewHost()->SaveImageAt( 1388 source_web_contents_->GetRenderViewHost()->SaveImageAt(
1388 params_.x, params_.y); 1389 params_.x, params_.y);
1389 } else { 1390 } else {
1390 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); 1391 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU);
1391 const GURL& url = params_.src_url; 1392 const GURL& url = params_.src_url;
1392 content::Referrer referrer = CreateSaveAsReferrer(url, params_); 1393 content::Referrer referrer = CreateSaveAsReferrer(url, params_);
1393 source_web_contents_->SaveFrame(url, referrer); 1394
1395 std::string headers;
1396 DataReductionProxyChromeSettings* settings =
1397 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
1398 browser_context_);
1399 if (params_.media_type == WebContextMenuData::MediaTypeImage &&
1400 settings && settings->CanUseDataReductionProxy(params_.src_url)) {
1401 headers = data_reduction_proxy::kDataReductionPassThroughHeader;
1402 }
1403
1404 source_web_contents_->SaveFrameWithHeaders(url, referrer, headers);
1394 } 1405 }
1395 break; 1406 break;
1396 } 1407 }
1397 1408
1398 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: 1409 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION:
1399 WriteURLToClipboard(params_.unfiltered_link_url); 1410 WriteURLToClipboard(params_.unfiltered_link_url);
1400 break; 1411 break;
1401 1412
1402 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: 1413 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION:
1403 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: 1414 case IDC_CONTENT_CONTEXT_COPYAVLOCATION:
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 source_web_contents_->GetRenderViewHost()-> 1815 source_web_contents_->GetRenderViewHost()->
1805 ExecuteMediaPlayerActionAtLocation(location, action); 1816 ExecuteMediaPlayerActionAtLocation(location, action);
1806 } 1817 }
1807 1818
1808 void RenderViewContextMenu::PluginActionAt( 1819 void RenderViewContextMenu::PluginActionAt(
1809 const gfx::Point& location, 1820 const gfx::Point& location,
1810 const WebPluginAction& action) { 1821 const WebPluginAction& action) {
1811 source_web_contents_->GetRenderViewHost()-> 1822 source_web_contents_->GetRenderViewHost()->
1812 ExecutePluginActionAtLocation(location, action); 1823 ExecutePluginActionAtLocation(location, action);
1813 } 1824 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698