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

Unified Diff: chrome/browser/printing/print_view_manager_common.cc

Issue 2510753002: Revert of Make printing work better with OOPIF. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/print_view_manager_common.cc
diff --git a/chrome/browser/printing/print_view_manager_common.cc b/chrome/browser/printing/print_view_manager_common.cc
index 1832389b903dbcecca9c41c942db7b7ee6e32121..83a94f7f5b21f4afca2e69cc1bff910cd6bc131f 100644
--- a/chrome/browser/printing/print_view_manager_common.cc
+++ b/chrome/browser/printing/print_view_manager_common.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/printing/print_view_manager_common.h"
-#include "content/public/browser/render_frame_host.h"
#include "extensions/features/features.h"
#include "printing/features/features.h"
@@ -20,7 +19,6 @@
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
namespace printing {
-
namespace {
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Stores |guest_contents| in |result| and returns true if |guest_contents| is a
@@ -53,73 +51,43 @@
return contents;
}
-// Pick the right RenderFrameHost based on the WebContentses.
-content::RenderFrameHost* GetRenderFrameHostToUse(
- content::WebContents* original_contents,
- content::WebContents* contents_to_use) {
- if (original_contents != contents_to_use)
- return contents_to_use->GetMainFrame();
- return GetFrameToPrint(contents_to_use);
-}
-
} // namespace
void StartPrint(content::WebContents* contents,
bool print_preview_disabled,
- bool has_selection) {
+ bool selection_only) {
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
using PrintViewManagerImpl = PrintViewManager;
#else
using PrintViewManagerImpl = PrintViewManagerBasic;
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
- content::WebContents* contents_to_use = GetWebContentsToUse(contents);
auto* print_view_manager =
- PrintViewManagerImpl::FromWebContents(contents_to_use);
+ PrintViewManagerImpl::FromWebContents(GetWebContentsToUse(contents));
if (!print_view_manager)
return;
-
- content::RenderFrameHost* rfh_to_use =
- GetRenderFrameHostToUse(contents, contents_to_use);
- if (!rfh_to_use)
- return;
-
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
if (!print_preview_disabled) {
- print_view_manager->PrintPreviewNow(rfh_to_use, has_selection);
+ print_view_manager->PrintPreviewNow(selection_only);
return;
}
#endif // ENABLE_PRINT_PREVIEW
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
- print_view_manager->PrintNow(rfh_to_use);
+ print_view_manager->PrintNow();
#endif // ENABLE_BASIC_PRINTING
}
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
void StartBasicPrint(content::WebContents* contents) {
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
- content::WebContents* contents_to_use = GetWebContentsToUse(contents);
PrintViewManager* print_view_manager =
- PrintViewManager::FromWebContents(contents_to_use);
+ PrintViewManager::FromWebContents(GetWebContentsToUse(contents));
if (!print_view_manager)
return;
-
- content::RenderFrameHost* rfh_to_use =
- GetRenderFrameHostToUse(contents, contents_to_use);
- if (!rfh_to_use)
- return;
-
- print_view_manager->BasicPrint(rfh_to_use);
+ print_view_manager->BasicPrint();
#endif // ENABLE_PRINT_PREVIEW
}
#endif // ENABLE_BASIC_PRINTING
-content::RenderFrameHost* GetFrameToPrint(content::WebContents* contents) {
- auto* focused_frame = contents->GetFocusedFrame();
- return (focused_frame && focused_frame->HasSelection())
- ? focused_frame
- : contents->GetMainFrame();
-}
-
} // namespace printing
« no previous file with comments | « chrome/browser/printing/print_view_manager_common.h ('k') | chrome/browser/printing/printing_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698