OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/printing/test/print_test_content_renderer_client.h" | 5 #include "components/printing/test/print_test_content_renderer_client.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "components/printing/renderer/print_web_view_helper.h" | 8 #include "components/printing/renderer/print_web_view_helper.h" |
| 9 #include "printing/features/features.h" |
9 #include "third_party/WebKit/public/web/WebElement.h" | 10 #include "third_party/WebKit/public/web/WebElement.h" |
10 | 11 |
11 namespace printing { | 12 namespace printing { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 class PrintWebViewHelperDelegate : public PrintWebViewHelper::Delegate { | 16 class PrintWebViewHelperDelegate : public PrintWebViewHelper::Delegate { |
16 public: | 17 public: |
17 ~PrintWebViewHelperDelegate() override {} | 18 ~PrintWebViewHelperDelegate() override {} |
18 bool CancelPrerender(content::RenderView* render_view, | 19 bool CancelPrerender(content::RenderView* render_view, |
19 int routing_id) override { | 20 int routing_id) override { |
20 return false; | 21 return false; |
21 } | 22 } |
22 blink::WebElement GetPdfElement(blink::WebLocalFrame* frame) override { | 23 blink::WebElement GetPdfElement(blink::WebLocalFrame* frame) override { |
23 return blink::WebElement(); | 24 return blink::WebElement(); |
24 } | 25 } |
25 bool IsPrintPreviewEnabled() override { | 26 bool IsPrintPreviewEnabled() override { |
26 #if defined(ENABLE_PRINT_PREVIEW) | 27 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
27 return true; | 28 return true; |
28 #else | 29 #else |
29 return false; | 30 return false; |
30 #endif | 31 #endif |
31 } | 32 } |
32 bool OverridePrint(blink::WebLocalFrame* frame) override { return false; } | 33 bool OverridePrint(blink::WebLocalFrame* frame) override { return false; } |
33 }; | 34 }; |
34 | 35 |
35 } // namespace | 36 } // namespace |
36 | 37 |
37 PrintTestContentRendererClient::PrintTestContentRendererClient() { | 38 PrintTestContentRendererClient::PrintTestContentRendererClient() { |
38 } | 39 } |
39 | 40 |
40 PrintTestContentRendererClient::~PrintTestContentRendererClient() { | 41 PrintTestContentRendererClient::~PrintTestContentRendererClient() { |
41 } | 42 } |
42 | 43 |
43 void PrintTestContentRendererClient::RenderViewCreated( | 44 void PrintTestContentRendererClient::RenderViewCreated( |
44 content::RenderView* render_view) { | 45 content::RenderView* render_view) { |
45 new printing::PrintWebViewHelper( | 46 new printing::PrintWebViewHelper( |
46 render_view, base::MakeUnique<PrintWebViewHelperDelegate>()); | 47 render_view, base::MakeUnique<PrintWebViewHelperDelegate>()); |
47 } | 48 } |
48 | 49 |
49 } // namespace printing | 50 } // namespace printing |
OLD | NEW |