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

Unified Diff: chrome/browser/printing/print_preview_message_handler.cc

Issue 8879046: Print preview: Disable the right context menu items in print preview. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/print_preview_message_handler.cc
===================================================================
--- chrome/browser/printing/print_preview_message_handler.cc (revision 113720)
+++ chrome/browser/printing/print_preview_message_handler.cc (working copy)
@@ -21,6 +21,7 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_restriction.h"
#include "printing/page_size_margins.h"
#include "printing/print_job_constants.h"
@@ -243,6 +244,15 @@
return handled;
}
+void PrintPreviewMessageHandler::DidStartLoading() {
+ // This helps prevents the print preview tab from being able to print.
Lei Zhang 2011/12/09 07:07:49 Should not have removed this earlier.
+ // It also disables the print menu entry.
+ if (tab_contents()->delegate() &&
+ PrintPreviewTabController::IsPrintPreviewTab(tab_contents_wrapper())) {
+ tab_contents()->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT);
+ }
+}
+
void PrintPreviewMessageHandler::NavigateToPendingEntry(
const GURL& url,
NavigationController::ReloadType reload_type) {

Powered by Google App Engine
This is Rietveld 408576698