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

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

Issue 2508923003: Make printing work better with OOPIF. (try 2) (Closed)
Patch Set: Fix android_webview 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
« no previous file with comments | « components/printing/common/print_messages.h ('k') | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 510b912e3c3353472a472a4826efc0c59f5327c4..2dad908dc266d66ddaba8f4a0736e934d3d0ec4f 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/features/features.h"
#include "printing/pdf_metafile_skia.h"
#include "third_party/WebKit/public/platform/WebCanvas.h"
@@ -78,17 +78,16 @@ 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:
virtual ~Delegate() {}
- // 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,
- int routing_id) = 0;
+ // Cancels prerender if it's currently in progress and returns true if the
+ // cancellation succeeded.
+ virtual bool CancelPrerender(content::RenderFrame* render_frame) = 0;
// Returns the element to be printed. Returns a null WebElement if
// a pdf plugin element can't be extracted from the frame.
@@ -109,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;
@@ -122,7 +121,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);
@@ -168,12 +167,13 @@ class PrintWebViewHelper
PRINT_PREVIEW_SCRIPTED // triggered by window.print().
};
- // RenderViewObserver implementation.
- bool OnMessageReceived(const IPC::Message& message) override;
- void PrintPage(blink::WebLocalFrame* frame, bool user_initiated) override;
- void DidStartLoading() override;
- void DidStopLoading() override;
+ // RenderFrameObserver implementation.
void OnDestruct() override;
+ void DidStartProvisionalLoad() override;
+ void DidFailProvisionalLoad(const blink::WebURLError& error) override;
+ void DidFinishLoad() override;
+ void ScriptedPrint(bool user_initiated) override;
+ bool OnMessageReceived(const IPC::Message& message) override;
// Message handlers ---------------------------------------------------------
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
@@ -182,7 +182,7 @@ class PrintWebViewHelper
void OnPrintForPrintPreview(const base::DictionaryValue& job_settings);
#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
- void OnInitiatePrintPreview(bool selection_only);
+ void OnInitiatePrintPreview(bool has_selection);
void OnPrintPreview(const base::DictionaryValue& settings);
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
void OnPrintingDone(bool success);
@@ -216,9 +216,8 @@ class PrintWebViewHelper
bool FinalizePrintReadyDocument();
#endif // BUILDFLAG(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 OnSetPrintingEnabled(bool enabled);
// Main printing code -------------------------------------------------------
@@ -341,8 +340,6 @@ class PrintWebViewHelper
const PrintMsg_Print_Params& params);
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
- bool GetPrintFrame(blink::WebLocalFrame** frame);
-
// Script Initiated Printing ------------------------------------------------
// Return true if script initiated printing is currently
@@ -379,8 +376,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.
« no previous file with comments | « components/printing/common/print_messages.h ('k') | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698