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

Unified Diff: chrome/browser/printing/print_preview_context_menu_observer.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: fix win build 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_context_menu_observer.cc
===================================================================
--- chrome/browser/printing/print_preview_context_menu_observer.cc (revision 0)
+++ chrome/browser/printing/print_preview_context_menu_observer.cc (revision 0)
@@ -0,0 +1,53 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/printing/print_preview_context_menu_observer.h"
+
+#include "base/logging.h"
+#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/printing/print_preview_tab_controller.h"
+
+PrintPreviewContextMenuObserver::PrintPreviewContextMenuObserver(
+ TabContentsWrapper* tab) : tab_(tab) {
+}
+
+PrintPreviewContextMenuObserver::~PrintPreviewContextMenuObserver() {
+}
+
+bool PrintPreviewContextMenuObserver::IsPrintPreviewTab() {
+ printing::PrintPreviewTabController* controller =
+ printing::PrintPreviewTabController::GetInstance();
+ if (!controller)
+ return false;
+ return !!controller->GetPrintPreviewForTab(tab_);
+}
+
+bool PrintPreviewContextMenuObserver::IsCommandIdSupported(int command_id) {
+ switch (command_id) {
+ case IDC_PRINT:
+ case IDC_VIEW_SOURCE:
+ case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
+ case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
+ case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
+ return IsPrintPreviewTab();
+
+ default:
+ return false;
+ }
+}
+
+bool PrintPreviewContextMenuObserver::IsCommandIdEnabled(int command_id) {
+ switch (command_id) {
+ case IDC_PRINT:
+ case IDC_VIEW_SOURCE:
+ case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
+ case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
+ case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
+ return false;
+
+ default:
+ NOTREACHED();
+ return true;
+ }
+}
Property changes on: chrome/browser/printing/print_preview_context_menu_observer.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/printing/print_preview_context_menu_observer.h ('k') | chrome/browser/tab_contents/render_view_context_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698