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

Side by Side 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: '' 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/printing/print_preview_context_menu_observer.h"
6
7 #include "base/logging.h"
8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/printing/print_preview_tab_controller.h"
10
11 PrintPreviewContextMenuObserver::PrintPreviewContextMenuObserver(
12 TabContentsWrapper* tab) : tab_(tab) {
13 }
14
15 PrintPreviewContextMenuObserver::~PrintPreviewContextMenuObserver() {
16 }
17
18 bool PrintPreviewContextMenuObserver::IsPrintPreviewTab() {
19 printing::PrintPreviewTabController* controller =
20 printing::PrintPreviewTabController::GetInstance();
21 if (!controller)
22 return false;
23 return controller->GetPrintPreviewForTab(tab_);
24 }
25
26 bool PrintPreviewContextMenuObserver::IsCommandIdSupported(int command_id) {
27 switch (command_id) {
28 case IDC_PRINT:
29 case IDC_VIEW_SOURCE:
30 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
31 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
32 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
33 return true;
vandebo (ex-Chrome) 2011/12/10 02:18:22 I think IdSupported is the one that should return
Lei Zhang 2011/12/10 02:31:33 Done.
34
35 default:
36 return false;
37 }
38 }
39
40 bool PrintPreviewContextMenuObserver::IsCommandIdEnabled(int command_id) {
41 switch (command_id) {
42 case IDC_PRINT:
43 case IDC_VIEW_SOURCE:
44 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
45 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
46 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
47 return !IsPrintPreviewTab();
48
49 default:
50 NOTREACHED();
51 return true;
52 }
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698