| 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 948 |
| 949 bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { | 949 bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { |
| 950 DCHECK(frame); | 950 DCHECK(frame); |
| 951 blink::WebView* webView = render_view()->GetWebView(); | 951 blink::WebView* webView = render_view()->GetWebView(); |
| 952 DCHECK(webView); | 952 DCHECK(webView); |
| 953 if (!webView) | 953 if (!webView) |
| 954 return false; | 954 return false; |
| 955 | 955 |
| 956 // If the user has selected text in the currently focused frame we print | 956 // If the user has selected text in the currently focused frame we print |
| 957 // only that frame (this makes print selection work for multiple frames). | 957 // only that frame (this makes print selection work for multiple frames). |
| 958 blink::WebLocalFrame* focusedFrame = | 958 blink::WebLocalFrame* focusedFrame = webView->focusedFrame(); |
| 959 webView->focusedFrame()->toWebLocalFrame(); | |
| 960 *frame = focusedFrame->hasSelection() | 959 *frame = focusedFrame->hasSelection() |
| 961 ? focusedFrame | 960 ? focusedFrame |
| 962 : webView->mainFrame()->toWebLocalFrame(); | 961 : webView->mainFrame()->toWebLocalFrame(); |
| 963 return true; | 962 return true; |
| 964 } | 963 } |
| 965 | 964 |
| 966 #if defined(ENABLE_BASIC_PRINTING) | 965 #if defined(ENABLE_BASIC_PRINTING) |
| 967 void PrintWebViewHelper::OnPrintPages() { | 966 void PrintWebViewHelper::OnPrintPages() { |
| 968 if (ipc_nesting_level_> 1) | 967 if (ipc_nesting_level_> 1) |
| 969 return; | 968 return; |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 blink::WebConsoleMessage::LevelWarning, message)); | 2248 blink::WebConsoleMessage::LevelWarning, message)); |
| 2250 return false; | 2249 return false; |
| 2251 } | 2250 } |
| 2252 | 2251 |
| 2253 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2252 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
| 2254 // Reset counter on successful print. | 2253 // Reset counter on successful print. |
| 2255 count_ = 0; | 2254 count_ = 0; |
| 2256 } | 2255 } |
| 2257 | 2256 |
| 2258 } // namespace printing | 2257 } // namespace printing |
| OLD | NEW |