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

Unified Diff: components/printing/renderer/print_web_view_helper.h

Issue 2426503002: Make printing work better with OOPIF. (Closed)
Patch Set: Fix build, fix some tests Created 4 years, 2 months 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: components/printing/renderer/print_web_view_helper.h
diff --git a/components/printing/renderer/print_web_view_helper.h b/components/printing/renderer/print_web_view_helper.h
index dd8d24d5b42458d47c615562d768d84f8d291e8f..7413ebef25d2150d52763c9029cdebe12d2a91d5 100644
--- a/components/printing/renderer/print_web_view_helper.h
+++ b/components/printing/renderer/print_web_view_helper.h
@@ -15,8 +15,8 @@
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "build/build_config.h"
-#include "content/public/renderer/render_view_observer.h"
-#include "content/public/renderer/render_view_observer_tracker.h"
+#include "content/public/renderer/render_frame_observer.h"
+#include "content/public/renderer/render_frame_observer_tracker.h"
#include "printing/pdf_metafile_skia.h"
#include "third_party/WebKit/public/platform/WebCanvas.h"
#include "third_party/WebKit/public/web/WebNode.h"
@@ -77,8 +77,8 @@ class FrameReference {
// We plan on making print asynchronous and that will require copying the DOM
// of the document and creating a new WebView with the contents.
class PrintWebViewHelper
- : public content::RenderViewObserver,
- public content::RenderViewObserverTracker<PrintWebViewHelper> {
+ : public content::RenderFrameObserver,
+ public content::RenderFrameObserverTracker<PrintWebViewHelper> {
public:
class Delegate {
public:
@@ -86,7 +86,7 @@ class PrintWebViewHelper
// Cancels prerender if it's currently in progress and returns |true| if
// the cancellation was done with success.
- virtual bool CancelPrerender(content::RenderView* render_view,
+ virtual bool CancelPrerender(content::RenderFrame* render_frame,
int routing_id) = 0;
// Returns the element to be printed. Returns a null WebElement if
@@ -108,7 +108,7 @@ class PrintWebViewHelper
virtual bool OverridePrint(blink::WebLocalFrame* frame) = 0;
};
- PrintWebViewHelper(content::RenderView* render_view,
+ PrintWebViewHelper(content::RenderFrame* render_frame,
std::unique_ptr<Delegate> delegate);
~PrintWebViewHelper() override;
@@ -116,7 +116,7 @@ class PrintWebViewHelper
// printing is build-in. This method is used by CEF.
static void DisablePreview();
- bool IsPrintingEnabled();
+ bool IsPrintingEnabled() const;
void PrintNode(const blink::WebNode& node);
@@ -162,9 +162,9 @@ class PrintWebViewHelper
PRINT_PREVIEW_SCRIPTED // triggered by window.print().
};
- // RenderViewObserver implementation.
+ // RenderFrameObserver implementation.
bool OnMessageReceived(const IPC::Message& message) override;
- void PrintPage(blink::WebLocalFrame* frame, bool user_initiated) override;
+ void ScriptedPrint(bool user_initiated) override;
void DidStartLoading() override;
void DidStopLoading() override;
void OnDestruct() override;
@@ -176,7 +176,7 @@ class PrintWebViewHelper
void OnPrintForPrintPreview(const base::DictionaryValue& job_settings);
#endif // defined(ENABLE_BASIC_PRINTING)
#if defined(ENABLE_PRINT_PREVIEW)
- void OnInitiatePrintPreview(bool selection_only);
+ void OnInitiatePrintPreview(bool has_selection);
void OnPrintPreview(const base::DictionaryValue& settings);
#endif // defined(ENABLE_PRINT_PREVIEW)
void OnPrintingDone(bool success);
@@ -210,9 +210,8 @@ class PrintWebViewHelper
bool FinalizePrintReadyDocument();
#endif // defined(ENABLE_PRINT_PREVIEW)
- // Enable/Disable window.print calls. If |blocked| is true window.print
- // calls will silently fail. Call with |blocked| set to false to reenable.
- void SetScriptedPrintBlocked(bool blocked);
+ // Enable/Disable printing.
+ void SetPrintingEnabled(bool enabled);
// Main printing code -------------------------------------------------------
@@ -335,8 +334,6 @@ class PrintWebViewHelper
const PrintMsg_Print_Params& params);
#endif // defined(ENABLE_PRINT_PREVIEW)
- bool GetPrintFrame(blink::WebLocalFrame** frame);
-
// Script Initiated Printing ------------------------------------------------
// Return true if script initiated printing is currently
@@ -373,8 +370,7 @@ class PrintWebViewHelper
bool is_print_ready_metafile_sent_;
bool ignore_css_margins_;
- // Used for scripted initiated printing blocking.
- bool is_scripted_printing_blocked_;
+ bool is_printing_enabled_;
// Let the browser process know of a printing failure. Only set to false when
// the failure came from the browser in the first place.

Powered by Google App Engine
This is Rietveld 408576698