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

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: Grammar 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/renderer/plugins/pdf_plugin_placeholder.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..f8536573856854b9918179f8b2f68e435dec93e1 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,7 @@ PDFPluginPlaceholder* PDFPluginPlaceholder::CreatePDFPlaceholder(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PDF_PLUGIN_HTML));
base::DictionaryValue values;
+ values.SetString("fileName", GURL(params.url).ExtractFileName());
std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
return new PDFPluginPlaceholder(render_frame, params, html_data);
}
@@ -37,9 +40,10 @@ gin::ObjectTemplateBuilder PDFPluginPlaceholder::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return gin::Wrappable<PDFPluginPlaceholder>::GetObjectTemplateBuilder(isolate)
.SetMethod<void (PDFPluginPlaceholder::*)()>(
- "downloadPDF", &PDFPluginPlaceholder::DownloadPDFCallback);
+ "openPDF", &PDFPluginPlaceholder::OpenPDFCallback);
}
-void PDFPluginPlaceholder::DownloadPDFCallback() {
- // TODO(amberwon): Implement starting PDF download.
+void PDFPluginPlaceholder::OpenPDFCallback() {
+ content::RenderThread::Get()->Send(
+ new ChromeViewHostMsg_OpenPDF(routing_id(), GetPluginParams().url));
}
« no previous file with comments | « chrome/renderer/plugins/pdf_plugin_placeholder.h ('k') | chrome/renderer/resources/plugins/pdf_plugin.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698