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

Unified Diff: chrome/renderer/plugins/pdf_plugin_placeholder.cc

Issue 2972123002: Click to Open PDF: Open PDF once View PDF is clicked. (Closed)
Patch Set: . Created 3 years, 5 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
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/resources/plugins/pdf_plugin.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/plugins/pdf_plugin_placeholder.cc
diff --git a/chrome/renderer/plugins/pdf_plugin_placeholder.cc b/chrome/renderer/plugins/pdf_plugin_placeholder.cc
index 6e20cfbce38d5d95d2839659ae16a40719d2095a..bf95ca60fa22eb3b08c2493c8727a562bd132491 100644
--- a/chrome/renderer/plugins/pdf_plugin_placeholder.cc
+++ b/chrome/renderer/plugins/pdf_plugin_placeholder.cc
@@ -4,7 +4,9 @@
#include "chrome/renderer/plugins/pdf_plugin_placeholder.h"
+#include "chrome/common/render_messages.h"
#include "chrome/grit/renderer_resources.h"
+#include "content/public/renderer/render_thread.h"
#include "gin/object_template_builder.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
@@ -25,6 +27,8 @@ PDFPluginPlaceholder* PDFPluginPlaceholder::CreatePDFPlaceholder(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PDF_PLUGIN_HTML));
base::DictionaryValue values;
+ GURL url = params.url;
Lei Zhang 2017/07/07 21:08:20 Can this be written as: values.SetString("fileNam
amberwon 2017/07/07 21:23:09 Yes, it can. Done.
+ values.SetString("fileName", url.ExtractFileName());
std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
return new PDFPluginPlaceholder(render_frame, params, html_data);
}
@@ -41,5 +45,6 @@ gin::ObjectTemplateBuilder PDFPluginPlaceholder::GetObjectTemplateBuilder(
}
void PDFPluginPlaceholder::DownloadPDFCallback() {
- // TODO(amberwon): Implement starting PDF download.
+ content::RenderThread::Get()->Send(
+ new ChromeViewHostMsg_DownloadPDF(routing_id(), GetPluginParams().url));
}
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/resources/plugins/pdf_plugin.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698