Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / printing / test / print_test_content_renderer_client.cc
blobb5947cefe695778b65d2355d3ad9f196771117c2
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
3 // found in the LICENSE file.
5 #include "components/printing/test/print_test_content_renderer_client.h"
7 #include "components/printing/renderer/print_web_view_helper.h"
8 #include "third_party/WebKit/public/web/WebElement.h"
10 namespace printing {
12 namespace {
13 class PrintWebViewHelperDelegate : public PrintWebViewHelper::Delegate {
14 public:
15 ~PrintWebViewHelperDelegate() override {}
16 bool CancelPrerender(content::RenderView* render_view,
17 int routing_id) override {
18 return false;
20 blink::WebElement GetPdfElement(blink::WebLocalFrame* frame) override {
21 return blink::WebElement();
23 bool IsPrintPreviewEnabled() override {
24 #if defined(ENABLE_PRINT_PREVIEW)
25 return true;
26 #else
27 return false;
28 #endif
30 bool OverridePrint(blink::WebLocalFrame* frame) override { return false; }
34 PrintTestContentRendererClient::PrintTestContentRendererClient() {
37 PrintTestContentRendererClient::~PrintTestContentRendererClient() {
40 void PrintTestContentRendererClient::RenderViewCreated(
41 content::RenderView* render_view) {
42 new printing::PrintWebViewHelper(
43 render_view, scoped_ptr<printing::PrintWebViewHelper::Delegate>(
44 new PrintWebViewHelperDelegate()));
47 } // namespace printing