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

Side by Side Diff: chrome/browser/printing/print_view_manager_common.cc

Issue 2458833005: Move printing defines to buildflag system. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_view_manager_common.h" 5 #include "chrome/browser/printing/print_view_manager_common.h"
6 6
7 #include "printing/features/features.h"
8
7 #if defined(ENABLE_EXTENSIONS) 9 #if defined(ENABLE_EXTENSIONS)
8 #include "components/guest_view/browser/guest_view_manager.h" 10 #include "components/guest_view/browser/guest_view_manager.h"
9 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h" 11 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h"
10 #endif // defined(ENABLE_EXTENSIONS) 12 #endif // defined(ENABLE_EXTENSIONS)
11 13
12 #if defined(ENABLE_PRINT_PREVIEW) 14 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
13 #include "chrome/browser/printing/print_view_manager.h" 15 #include "chrome/browser/printing/print_view_manager.h"
14 #else 16 #else
15 #include "chrome/browser/printing/print_view_manager_basic.h" 17 #include "chrome/browser/printing/print_view_manager_basic.h"
16 #endif // defined(ENABLE_PRINT_PREVIEW) 18 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
17 19
18 namespace printing { 20 namespace printing {
19 namespace { 21 namespace {
20 #if defined(ENABLE_EXTENSIONS) 22 #if defined(ENABLE_EXTENSIONS)
21 // Stores |guest_contents| in |result| and returns true if |guest_contents| is a 23 // Stores |guest_contents| in |result| and returns true if |guest_contents| is a
22 // full page MimeHandlerViewGuest plugin. Otherwise, returns false. 24 // full page MimeHandlerViewGuest plugin. Otherwise, returns false.
23 bool StoreFullPagePlugin(content::WebContents** result, 25 bool StoreFullPagePlugin(content::WebContents** result,
24 content::WebContents* guest_contents) { 26 content::WebContents* guest_contents) {
25 auto* guest_view = 27 auto* guest_view =
26 extensions::MimeHandlerViewGuest::FromWebContents(guest_contents); 28 extensions::MimeHandlerViewGuest::FromWebContents(guest_contents);
(...skipping 19 matching lines...) Expand all
46 } 48 }
47 #endif // defined(ENABLE_EXTENSIONS) 49 #endif // defined(ENABLE_EXTENSIONS)
48 return contents; 50 return contents;
49 } 51 }
50 52
51 } // namespace 53 } // namespace
52 54
53 void StartPrint(content::WebContents* contents, 55 void StartPrint(content::WebContents* contents,
54 bool print_preview_disabled, 56 bool print_preview_disabled,
55 bool selection_only) { 57 bool selection_only) {
56 #if defined(ENABLE_PRINT_PREVIEW) 58 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
57 using PrintViewManagerImpl = PrintViewManager; 59 using PrintViewManagerImpl = PrintViewManager;
58 #else 60 #else
59 using PrintViewManagerImpl = PrintViewManagerBasic; 61 using PrintViewManagerImpl = PrintViewManagerBasic;
60 #endif // defined(ENABLE_PRINT_PREVIEW) 62 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
61 63
62 auto* print_view_manager = 64 auto* print_view_manager =
63 PrintViewManagerImpl::FromWebContents(GetWebContentsToUse(contents)); 65 PrintViewManagerImpl::FromWebContents(GetWebContentsToUse(contents));
64 if (!print_view_manager) 66 if (!print_view_manager)
65 return; 67 return;
66 #if defined(ENABLE_PRINT_PREVIEW) 68 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
67 if (!print_preview_disabled) { 69 if (!print_preview_disabled) {
68 print_view_manager->PrintPreviewNow(selection_only); 70 print_view_manager->PrintPreviewNow(selection_only);
69 return; 71 return;
70 } 72 }
71 #endif // ENABLE_PRINT_PREVIEW 73 #endif // ENABLE_PRINT_PREVIEW
72 74
73 #if defined(ENABLE_BASIC_PRINTING) 75 #if BUILDFLAG(ENABLE_BASIC_PRINTING)
74 print_view_manager->PrintNow(); 76 print_view_manager->PrintNow();
75 #endif // ENABLE_BASIC_PRINTING 77 #endif // ENABLE_BASIC_PRINTING
76 } 78 }
77 79
78 #if defined(ENABLE_BASIC_PRINTING) 80 #if BUILDFLAG(ENABLE_BASIC_PRINTING)
79 void StartBasicPrint(content::WebContents* contents) { 81 void StartBasicPrint(content::WebContents* contents) {
80 #if defined(ENABLE_PRINT_PREVIEW) 82 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
81 PrintViewManager* print_view_manager = 83 PrintViewManager* print_view_manager =
82 PrintViewManager::FromWebContents(GetWebContentsToUse(contents)); 84 PrintViewManager::FromWebContents(GetWebContentsToUse(contents));
83 if (!print_view_manager) 85 if (!print_view_manager)
84 return; 86 return;
85 print_view_manager->BasicPrint(); 87 print_view_manager->BasicPrint();
86 #endif // ENABLE_PRINT_PREVIEW 88 #endif // ENABLE_PRINT_PREVIEW
87 } 89 }
88 #endif // ENABLE_BASIC_PRINTING 90 #endif // ENABLE_BASIC_PRINTING
89 91
90 } // namespace printing 92 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_view_manager_common.h ('k') | chrome/browser/printing/printing_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698