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

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

Issue 2957023002: Centralize the Data Reduction Proxy pass through header (Closed)
Patch Set: remove unused identity directive method Created 3 years, 5 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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 break; 1726 break;
1727 1727
1728 case IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE: 1728 case IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE:
1729 ExecSearchWebForImage(); 1729 ExecSearchWebForImage();
1730 break; 1730 break;
1731 1731
1732 case IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB: 1732 case IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB:
1733 OpenURLWithExtraHeaders( 1733 OpenURLWithExtraHeaders(
1734 params_.src_url, GetDocumentURL(params_), 1734 params_.src_url, GetDocumentURL(params_),
1735 WindowOpenDisposition::NEW_BACKGROUND_TAB, ui::PAGE_TRANSITION_LINK, 1735 WindowOpenDisposition::NEW_BACKGROUND_TAB, ui::PAGE_TRANSITION_LINK,
1736 data_reduction_proxy::kDataReductionPassThroughHeader, false); 1736 data_reduction_proxy::chrome_proxy_pass_through_header(), false);
1737 break; 1737 break;
1738 1738
1739 case IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE: 1739 case IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE:
1740 ExecLoadOriginalImage(); 1740 ExecLoadOriginalImage();
1741 break; 1741 break;
1742 1742
1743 case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: 1743 case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB:
1744 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: 1744 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB:
1745 OpenURL(params_.src_url, GetDocumentURL(params_), 1745 OpenURL(params_.src_url, GetDocumentURL(params_),
1746 WindowOpenDisposition::NEW_BACKGROUND_TAB, 1746 WindowOpenDisposition::NEW_BACKGROUND_TAB,
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); 2238 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU);
2239 const GURL& url = params_.src_url; 2239 const GURL& url = params_.src_url;
2240 content::Referrer referrer = CreateReferrer(url, params_); 2240 content::Referrer referrer = CreateReferrer(url, params_);
2241 2241
2242 std::string headers; 2242 std::string headers;
2243 DataReductionProxyChromeSettings* settings = 2243 DataReductionProxyChromeSettings* settings =
2244 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 2244 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
2245 browser_context_); 2245 browser_context_);
2246 if (params_.media_type == WebContextMenuData::kMediaTypeImage && settings && 2246 if (params_.media_type == WebContextMenuData::kMediaTypeImage && settings &&
2247 settings->CanUseDataReductionProxy(params_.src_url)) { 2247 settings->CanUseDataReductionProxy(params_.src_url)) {
2248 headers = data_reduction_proxy::kDataReductionPassThroughHeader; 2248 headers = data_reduction_proxy::chrome_proxy_pass_through_header();
2249 } 2249 }
2250 2250
2251 source_web_contents_->SaveFrameWithHeaders(url, referrer, headers); 2251 source_web_contents_->SaveFrameWithHeaders(url, referrer, headers);
2252 } 2252 }
2253 } 2253 }
2254 2254
2255 void RenderViewContextMenu::ExecExitFullscreen() { 2255 void RenderViewContextMenu::ExecExitFullscreen() {
2256 Browser* browser = GetBrowser(); 2256 Browser* browser = GetBrowser();
2257 if (!browser) { 2257 if (!browser) {
2258 NOTREACHED(); 2258 NOTREACHED();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 void RenderViewContextMenu::PluginActionAt( 2457 void RenderViewContextMenu::PluginActionAt(
2458 const gfx::Point& location, 2458 const gfx::Point& location,
2459 const WebPluginAction& action) { 2459 const WebPluginAction& action) {
2460 source_web_contents_->GetRenderViewHost()-> 2460 source_web_contents_->GetRenderViewHost()->
2461 ExecutePluginActionAtLocation(location, action); 2461 ExecutePluginActionAtLocation(location, action);
2462 } 2462 }
2463 2463
2464 Browser* RenderViewContextMenu::GetBrowser() const { 2464 Browser* RenderViewContextMenu::GetBrowser() const {
2465 return chrome::FindBrowserWithWebContents(embedder_web_contents_); 2465 return chrome::FindBrowserWithWebContents(embedder_web_contents_);
2466 } 2466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698