OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/print_web_view_helper.h" | 5 #include "chrome/renderer/printing/print_web_view_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 897 |
898 blink::WebDocument document = main_frame->document(); | 898 blink::WebDocument document = main_frame->document(); |
899 // <object>/<iframe> with id="pdf-viewer" is created in | 899 // <object>/<iframe> with id="pdf-viewer" is created in |
900 // chrome/browser/resources/print_preview/print_preview.js | 900 // chrome/browser/resources/print_preview/print_preview.js |
901 blink::WebElement pdf_element = document.getElementById("pdf-viewer"); | 901 blink::WebElement pdf_element = document.getElementById("pdf-viewer"); |
902 if (pdf_element.isNull()) { | 902 if (pdf_element.isNull()) { |
903 NOTREACHED(); | 903 NOTREACHED(); |
904 return; | 904 return; |
905 } | 905 } |
906 | 906 |
907 // The out-of-process plugin element is nested within a frame. | 907 // The out-of-process plugin element is nested within a frame. In tests, there |
| 908 // may not be an iframe containing the out-of-process plugin, so continue with |
| 909 // the element with ID "pdf-viewer" if it isn't an iframe. |
908 blink::WebLocalFrame* plugin_frame = pdf_element.document().frame(); | 910 blink::WebLocalFrame* plugin_frame = pdf_element.document().frame(); |
909 blink::WebElement plugin_element = pdf_element; | 911 blink::WebElement plugin_element = pdf_element; |
910 if (switches::OutOfProcessPdfEnabled()) { | 912 if (switches::OutOfProcessPdfEnabled() && |
911 if (!pdf_element.hasHTMLTagName("iframe")) { | 913 pdf_element.hasHTMLTagName("iframe")) { |
912 NOTREACHED(); | |
913 return; | |
914 } | |
915 plugin_frame = blink::WebLocalFrame::fromFrameOwnerElement(pdf_element); | 914 plugin_frame = blink::WebLocalFrame::fromFrameOwnerElement(pdf_element); |
916 plugin_element = GetPdfElement(plugin_frame); | 915 plugin_element = GetPdfElement(plugin_frame); |
917 if (plugin_element.isNull()) { | 916 if (plugin_element.isNull()) { |
918 NOTREACHED(); | 917 NOTREACHED(); |
919 return; | 918 return; |
920 } | 919 } |
921 } | 920 } |
922 | 921 |
923 // Set |print_for_preview_| flag and autoreset it to back to original | 922 // Set |print_for_preview_| flag and autoreset it to back to original |
924 // on return. | 923 // on return. |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 blink::WebConsoleMessage::LevelWarning, message)); | 2054 blink::WebConsoleMessage::LevelWarning, message)); |
2056 return false; | 2055 return false; |
2057 } | 2056 } |
2058 | 2057 |
2059 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2058 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2060 // Reset counter on successful print. | 2059 // Reset counter on successful print. |
2061 count_ = 0; | 2060 count_ = 0; |
2062 } | 2061 } |
2063 | 2062 |
2064 } // namespace printing | 2063 } // namespace printing |
OLD | NEW |