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

Side by Side Diff: chrome/renderer/printing/chrome_print_web_view_helper_delegate.cc

Issue 2426503002: Make printing work better with OOPIF. (Closed)
Patch Set: Fix build, fix some tests Created 4 years, 2 months 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 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 "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" 5 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/render_messages.h" 12 #include "chrome/common/render_messages.h"
13 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
14 #include "chrome/renderer/prerender/prerender_helper.h" 14 #include "chrome/renderer/prerender/prerender_helper.h"
15 #include "content/public/renderer/render_frame.h" 15 #include "content/public/renderer/render_frame.h"
16 #include "content/public/renderer/render_view.h" 16 #include "content/public/renderer/render_view.h"
17 #include "ipc/ipc_message.h" 17 #include "ipc/ipc_message.h"
18 #include "third_party/WebKit/public/web/WebDocument.h" 18 #include "third_party/WebKit/public/web/WebDocument.h"
19 #include "third_party/WebKit/public/web/WebElement.h" 19 #include "third_party/WebKit/public/web/WebElement.h"
20 #include "third_party/WebKit/public/web/WebLocalFrame.h" 20 #include "third_party/WebKit/public/web/WebLocalFrame.h"
21 21
22 #if defined(ENABLE_EXTENSIONS) 22 #if defined(ENABLE_EXTENSIONS)
23 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
24 #include "extensions/common/constants.h" 24 #include "extensions/common/constants.h"
25 #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h" 25 #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h"
26 #endif // defined(ENABLE_EXTENSIONS) 26 #endif // defined(ENABLE_EXTENSIONS)
27 27
28 ChromePrintWebViewHelperDelegate::~ChromePrintWebViewHelperDelegate(){ 28 ChromePrintWebViewHelperDelegate::~ChromePrintWebViewHelperDelegate() {}
29 }
30 29
31 bool ChromePrintWebViewHelperDelegate::CancelPrerender( 30 bool ChromePrintWebViewHelperDelegate::CancelPrerender(
32 content::RenderView* render_view, int routing_id) { 31 content::RenderFrame* render_frame,
33 if (!render_view || !prerender::PrerenderHelper::IsPrerendering( 32 int routing_id) {
34 render_view->GetMainRenderFrame())) 33 if (!prerender::PrerenderHelper::IsPrerendering(render_frame))
35 return false; 34 return false;
36 35
37 return render_view->Send( 36 return render_frame->GetRenderView()->Send(
38 new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id)); 37 new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id));
39 } 38 }
40 39
41 // Return the PDF object element if |frame| is the out of process PDF extension. 40 // Return the PDF object element if |frame| is the out of process PDF extension.
42 blink::WebElement ChromePrintWebViewHelperDelegate::GetPdfElement( 41 blink::WebElement ChromePrintWebViewHelperDelegate::GetPdfElement(
43 blink::WebLocalFrame* frame) { 42 blink::WebLocalFrame* frame) {
44 #if defined(ENABLE_EXTENSIONS) 43 #if defined(ENABLE_EXTENSIONS)
45 GURL url = frame->document().url(); 44 GURL url = frame->document().url();
46 bool inside_print_preview = 45 bool inside_print_preview =
47 url.GetOrigin() == GURL(chrome::kChromeUIPrintURL); 46 url.GetOrigin() == GURL(chrome::kChromeUIPrintURL);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // PDF plugin document correctly print the PDF. See 79 // PDF plugin document correctly print the PDF. See
81 // https://crbug.com/448720. 80 // https://crbug.com/448720.
82 base::DictionaryValue message; 81 base::DictionaryValue message;
83 message.SetString("type", "print"); 82 message.SetString("type", "print");
84 mime_handlers.front()->PostMessageFromValue(message); 83 mime_handlers.front()->PostMessageFromValue(message);
85 return true; 84 return true;
86 } 85 }
87 #endif // defined(ENABLE_EXTENSIONS) 86 #endif // defined(ENABLE_EXTENSIONS)
88 return false; 87 return false;
89 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698