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

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

Issue 787783003: Expose WebContents from PrintingContextDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_job_worker.cc
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index ee8cddea181a9a759182b4d828a3d4a45ae424da..3f277c594182f0c9904fb903c3e1e70b1436946d 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -44,6 +44,9 @@ class PrintingContextDelegate : public PrintingContext::Delegate {
gfx::NativeView GetParentView() override;
std::string GetAppLocale() override;
+ // Not exposed to PrintingContext::Delegate because of dependency issues.
+ content::WebContents* GetWebContents();
+
private:
int render_process_id_;
int render_view_id_;
@@ -59,13 +62,15 @@ PrintingContextDelegate::~PrintingContextDelegate() {
}
gfx::NativeView PrintingContextDelegate::GetParentView() {
+ content::WebContents* wc = GetWebContents();
+ return wc ? wc->GetNativeView() : nullptr;
+}
+
+content::WebContents* PrintingContextDelegate::GetWebContents() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::RenderViewHost* view =
content::RenderViewHost::FromID(render_process_id_, render_view_id_);
- if (!view)
- return NULL;
- content::WebContents* wc = content::WebContents::FromRenderViewHost(view);
- return wc ? wc->GetNativeView() : NULL;
+ return view ? content::WebContents::FromRenderViewHost(view) : nullptr;
}
std::string PrintingContextDelegate::GetAppLocale() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698