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

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

Issue 7918011: Print Preview: Disable right click -> "Save As" for preview PDF. Users should just print to PDF i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "chrome/browser/tab_contents/render_view_context_menu.h" 8 #include "chrome/browser/tab_contents/render_view_context_menu.h"
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/debugger/devtools_window.h" 22 #include "chrome/browser/debugger/devtools_window.h"
23 #include "chrome/browser/extensions/extension_event_router.h" 23 #include "chrome/browser/extensions/extension_event_router.h"
24 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/google/google_util.h" 25 #include "chrome/browser/google/google_util.h"
26 #include "chrome/browser/net/browser_url_util.h" 26 #include "chrome/browser/net/browser_url_util.h"
27 #include "chrome/browser/page_info_window.h" 27 #include "chrome/browser/page_info_window.h"
28 #include "chrome/browser/prefs/incognito_mode_prefs.h" 28 #include "chrome/browser/prefs/incognito_mode_prefs.h"
29 #include "chrome/browser/prefs/pref_member.h" 29 #include "chrome/browser/prefs/pref_member.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/printing/print_preview_tab_controller.h"
31 #include "chrome/browser/printing/print_view_manager.h" 32 #include "chrome/browser/printing/print_view_manager.h"
32 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/browser/profiles/profile_io_data.h" 34 #include "chrome/browser/profiles/profile_io_data.h"
34 #include "chrome/browser/search_engines/template_url.h" 35 #include "chrome/browser/search_engines/template_url.h"
35 #include "chrome/browser/search_engines/template_url_service.h" 36 #include "chrome/browser/search_engines/template_url_service.h"
36 #include "chrome/browser/search_engines/template_url_service_factory.h" 37 #include "chrome/browser/search_engines/template_url_service_factory.h"
37 #include "chrome/browser/spellchecker/spellcheck_host.h" 38 #include "chrome/browser/spellchecker/spellcheck_host.h"
38 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" 39 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
39 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" 40 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h"
40 #include "chrome/browser/tab_contents/spelling_menu_observer.h" 41 #include "chrome/browser/tab_contents/spelling_menu_observer.h"
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: 1184 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION:
1184 return params_.src_url.is_valid(); 1185 return params_.src_url.is_valid();
1185 1186
1186 case IDC_CONTENT_CONTEXT_SAVEAVAS: { 1187 case IDC_CONTENT_CONTEXT_SAVEAVAS: {
1187 PrefService* local_state = g_browser_process->local_state(); 1188 PrefService* local_state = g_browser_process->local_state();
1188 DCHECK(local_state); 1189 DCHECK(local_state);
1189 // Test if file-selection dialogs are forbidden by policy. 1190 // Test if file-selection dialogs are forbidden by policy.
1190 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) 1191 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs))
1191 return false; 1192 return false;
1192 1193
1193 return (params_.media_flags & 1194 const GURL& url = params_.src_url;
1194 WebContextMenuData::MediaCanSave) && 1195 return (params_.media_flags & WebContextMenuData::MediaCanSave) &&
1195 params_.src_url.is_valid() && 1196 url.is_valid() && ProfileIOData::IsHandledProtocol(url.scheme()) &&
1196 ProfileIOData::IsHandledProtocol(params_.src_url.scheme()); 1197 // Do not save the preview PDF on the print preview page.
1198 !(printing::PrintPreviewTabController::IsPrintPreviewURL(url));
1197 } 1199 }
1198 1200
1199 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: 1201 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB:
1200 return true; 1202 return true;
1201 1203
1202 case IDC_SAVE_PAGE: { 1204 case IDC_SAVE_PAGE: {
1203 PrefService* local_state = g_browser_process->local_state(); 1205 PrefService* local_state = g_browser_process->local_state();
1204 DCHECK(local_state); 1206 DCHECK(local_state);
1205 // Test if file-selection dialogs are forbidden by policy. 1207 // Test if file-selection dialogs are forbidden by policy.
1206 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) 1208 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs))
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 g_browser_process->clipboard()); 1942 g_browser_process->clipboard());
1941 } 1943 }
1942 1944
1943 void RenderViewContextMenu::MediaPlayerActionAt( 1945 void RenderViewContextMenu::MediaPlayerActionAt(
1944 const gfx::Point& location, 1946 const gfx::Point& location,
1945 const WebMediaPlayerAction& action) { 1947 const WebMediaPlayerAction& action) {
1946 RenderViewHost* rvh = source_tab_contents_->render_view_host(); 1948 RenderViewHost* rvh = source_tab_contents_->render_view_host();
1947 rvh->Send(new ViewMsg_MediaPlayerActionAt( 1949 rvh->Send(new ViewMsg_MediaPlayerActionAt(
1948 rvh->routing_id(), location, action)); 1950 rvh->routing_id(), location, action));
1949 } 1951 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698