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

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

Issue 2566153007: Implement PrintBrowser functionality. (Closed)
Patch Set: Fix git weirdness Created 4 years 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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #if BUILDFLAG(ENABLE_EXTENSIONS) 44 #if BUILDFLAG(ENABLE_EXTENSIONS)
45 GURL url = frame->document().url(); 45 GURL url = frame->document().url();
46 bool inside_print_preview = url.GetOrigin() == chrome::kChromeUIPrintURL; 46 bool inside_print_preview = url.GetOrigin() == chrome::kChromeUIPrintURL;
47 bool inside_pdf_extension = 47 bool inside_pdf_extension =
48 url.SchemeIs(extensions::kExtensionScheme) && 48 url.SchemeIs(extensions::kExtensionScheme) &&
49 url.host_piece() == extension_misc::kPdfExtensionId; 49 url.host_piece() == extension_misc::kPdfExtensionId;
50 if (inside_print_preview || inside_pdf_extension) { 50 if (inside_print_preview || inside_pdf_extension) {
51 // <object> with id="plugin" is created in 51 // <object> with id="plugin" is created in
52 // chrome/browser/resources/pdf/pdf.js. 52 // chrome/browser/resources/pdf/pdf.js.
53 auto plugin_element = frame->document().getElementById("plugin"); 53 auto plugin_element = frame->document().getElementById("plugin");
54 if (!plugin_element.isNull()) { 54 if (!plugin_element.isNull()) {
skau 2016/12/16 18:32:50 Why is there a situation where this is null now?
55 return plugin_element; 55 return plugin_element;
56 } 56 }
57 NOTREACHED();
58 } 57 }
59 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 58 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
60 return blink::WebElement(); 59 return blink::WebElement();
61 } 60 }
62 61
63 bool ChromePrintWebViewHelperDelegate::IsPrintPreviewEnabled() { 62 bool ChromePrintWebViewHelperDelegate::IsPrintPreviewEnabled() {
64 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 63 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
65 return !command_line->HasSwitch(switches::kDisablePrintPreview); 64 return !command_line->HasSwitch(switches::kDisablePrintPreview);
66 } 65 }
67 66
(...skipping 12 matching lines...) Expand all
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 // BUILDFLAG(ENABLE_EXTENSIONS) 86 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
88 return false; 87 return false;
89 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698