OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/printing/print_preview_context_menu_observer.h" | 5 #include "chrome/browser/printing/print_preview_context_menu_observer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 9 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
10 | 10 |
11 PrintPreviewContextMenuObserver::PrintPreviewContextMenuObserver( | 11 PrintPreviewContextMenuObserver::PrintPreviewContextMenuObserver( |
12 content::WebContents* contents) : contents_(contents) { | 12 content::WebContents* contents) : contents_(contents) { |
13 } | 13 } |
14 | 14 |
15 PrintPreviewContextMenuObserver::~PrintPreviewContextMenuObserver() { | 15 PrintPreviewContextMenuObserver::~PrintPreviewContextMenuObserver() { |
16 } | 16 } |
17 | 17 |
18 bool PrintPreviewContextMenuObserver::IsPrintPreviewDialog() { | 18 bool PrintPreviewContextMenuObserver::IsPrintPreviewDialog() { |
19 printing::PrintPreviewDialogController* controller = | 19 printing::PrintPreviewDialogController* controller = |
20 printing::PrintPreviewDialogController::GetInstance(); | 20 printing::PrintPreviewDialogController::GetInstance(); |
21 if (!controller) | 21 if (!controller) |
22 return false; | 22 return false; |
23 return (controller->GetPrintPreviewForContents(contents_) != NULL); | 23 return (controller->GetPrintPreviewForContents(contents_) != nullptr); |
24 } | 24 } |
25 | 25 |
26 bool PrintPreviewContextMenuObserver::IsCommandIdSupported(int command_id) { | 26 bool PrintPreviewContextMenuObserver::IsCommandIdSupported(int command_id) { |
27 switch (command_id) { | 27 switch (command_id) { |
28 case IDC_PRINT: | 28 case IDC_PRINT: |
29 case IDC_VIEW_SOURCE: | 29 case IDC_VIEW_SOURCE: |
30 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: | 30 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: |
31 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: | 31 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: |
32 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: | 32 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: |
33 return IsPrintPreviewDialog(); | 33 return IsPrintPreviewDialog(); |
(...skipping 10 matching lines...) Expand all Loading... |
44 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: | 44 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: |
45 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: | 45 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: |
46 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: | 46 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: |
47 return false; | 47 return false; |
48 | 48 |
49 default: | 49 default: |
50 NOTREACHED(); | 50 NOTREACHED(); |
51 return true; | 51 return true; |
52 } | 52 } |
53 } | 53 } |
OLD | NEW |