| 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 | 953 |
| 954 bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { | 954 bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { |
| 955 DCHECK(frame); | 955 DCHECK(frame); |
| 956 blink::WebView* webView = render_view()->GetWebView(); | 956 blink::WebView* webView = render_view()->GetWebView(); |
| 957 DCHECK(webView); | 957 DCHECK(webView); |
| 958 if (!webView) | 958 if (!webView) |
| 959 return false; | 959 return false; |
| 960 | 960 |
| 961 // If the user has selected text in the currently focused frame we print | 961 // If the user has selected text in the currently focused frame we print |
| 962 // only that frame (this makes print selection work for multiple frames). | 962 // only that frame (this makes print selection work for multiple frames). |
| 963 blink::WebLocalFrame* focusedFrame = | 963 blink::WebLocalFrame* focusedFrame = webView->focusedFrame(); |
| 964 webView->focusedFrame()->toWebLocalFrame(); | |
| 965 *frame = focusedFrame->hasSelection() | 964 *frame = focusedFrame->hasSelection() |
| 966 ? focusedFrame | 965 ? focusedFrame |
| 967 : webView->mainFrame()->toWebLocalFrame(); | 966 : webView->mainFrame()->toWebLocalFrame(); |
| 968 return true; | 967 return true; |
| 969 } | 968 } |
| 970 | 969 |
| 971 #if defined(ENABLE_BASIC_PRINTING) | 970 #if defined(ENABLE_BASIC_PRINTING) |
| 972 void PrintWebViewHelper::OnPrintPages() { | 971 void PrintWebViewHelper::OnPrintPages() { |
| 973 if (ipc_nesting_level_> 1) | 972 if (ipc_nesting_level_> 1) |
| 974 return; | 973 return; |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2255 blink::WebConsoleMessage::LevelWarning, message)); | 2254 blink::WebConsoleMessage::LevelWarning, message)); |
| 2256 return false; | 2255 return false; |
| 2257 } | 2256 } |
| 2258 | 2257 |
| 2259 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2258 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
| 2260 // Reset counter on successful print. | 2259 // Reset counter on successful print. |
| 2261 count_ = 0; | 2260 count_ = 0; |
| 2262 } | 2261 } |
| 2263 | 2262 |
| 2264 } // namespace printing | 2263 } // namespace printing |
| OLD | NEW |