diff options
author | gene@chromium.org <gene@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-15 22:50:06 +0000 |
---|---|---|
committer | gene@chromium.org <gene@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-15 22:50:06 +0000 |
commit | 216c369184095d1d3b932b264a622c796b4ba241 (patch) | |
tree | a2cbcb79db0f4c39e33161e22804da194c71d65d | |
parent | 3f6c743c119a8e7e81f13dafda3cd158fbb5cb69 (diff) | |
download | chromium_src-216c369184095d1d3b932b264a622c796b4ba241.zip chromium_src-216c369184095d1d3b932b264a622c796b4ba241.tar.gz chromium_src-216c369184095d1d3b932b264a622c796b4ba241.tar.bz2 |
Added functionality to use "SaveAs..." from PDF plugin.
It is exactly the same experience as user right-click and
select "SaveAs..." from pop-up menu. No disk access allowed for plugin.
DIscussed it with Chris Evans and he is ok with this solution from the security stand point.
Also added PDF resources for new UI.
BUG=56072,75235
TEST=none, will send PDF cl separately.
Review URL: http://codereview.chromium.org/6871020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81822 0039d316-1c4b-4281-b951-d872f2087c98
32 files changed, 82 insertions, 22 deletions
diff --git a/chrome/browser/ui/download/download_tab_helper.cc b/chrome/browser/ui/download/download_tab_helper.cc index 16bb44b..c7a5fee 100644 --- a/chrome/browser/ui/download/download_tab_helper.cc +++ b/chrome/browser/ui/download/download_tab_helper.cc @@ -7,11 +7,13 @@ #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_util.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/render_messages.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/view_messages.h" DownloadTabHelper::DownloadTabHelper(TabContents* tab_contents) - : tab_contents_(tab_contents) { - DCHECK(tab_contents_); + : TabContentsObserver(tab_contents) { + DCHECK(tab_contents); } DownloadTabHelper::~DownloadTabHelper() { @@ -19,23 +21,23 @@ DownloadTabHelper::~DownloadTabHelper() { void DownloadTabHelper::OnSavePage() { // If we can not save the page, try to download it. - if (!SavePackage::IsSavableContents(tab_contents_->contents_mime_type())) { - DownloadManager* dlm = tab_contents_->profile()->GetDownloadManager(); - const GURL& current_page_url = tab_contents_->GetURL(); + if (!SavePackage::IsSavableContents(tab_contents()->contents_mime_type())) { + DownloadManager* dlm = tab_contents()->profile()->GetDownloadManager(); + const GURL& current_page_url = tab_contents()->GetURL(); if (dlm && current_page_url.is_valid()) { - dlm->DownloadUrl(current_page_url, GURL(), "", tab_contents_); + dlm->DownloadUrl(current_page_url, GURL(), "", tab_contents()); download_util::RecordDownloadCount( download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); } return; } - tab_contents_->Stop(); + tab_contents()->Stop(); // Create the save package and possibly prompt the user for the name to save // the page as. The user prompt is an asynchronous operation that runs on // another thread. - save_package_ = new SavePackage(tab_contents_); + save_package_ = new SavePackage(tab_contents()); save_package_->GetSaveInfo(); } @@ -46,9 +48,20 @@ bool DownloadTabHelper::SavePage(const FilePath& main_file, const FilePath& dir_path, SavePackage::SavePackageType save_type) { // Stop the page from navigating. - tab_contents_->Stop(); + tab_contents()->Stop(); save_package_ = - new SavePackage(tab_contents_, save_type, main_file, dir_path); + new SavePackage(tab_contents(), save_type, main_file, dir_path); return save_package_->Init(); } + +bool DownloadTabHelper::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(DownloadTabHelper, message) + IPC_MESSAGE_HANDLER(ViewHostMsg_SaveAs, OnSavePage) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + + return handled; +} + diff --git a/chrome/browser/ui/download/download_tab_helper.h b/chrome/browser/ui/download/download_tab_helper.h index e8fcabf..6bd104b 100644 --- a/chrome/browser/ui/download/download_tab_helper.h +++ b/chrome/browser/ui/download/download_tab_helper.h @@ -8,10 +8,11 @@ #include "base/basictypes.h" #include "chrome/browser/download/save_package.h" +#include "content/browser/tab_contents/tab_contents_observer.h" // Per-tab download controller. Handles dealing with various per-tab download // duties. -class DownloadTabHelper { +class DownloadTabHelper : public TabContentsObserver { public: explicit DownloadTabHelper(TabContents* tab_contents); virtual ~DownloadTabHelper(); @@ -29,7 +30,8 @@ class DownloadTabHelper { SavePackage* save_package() const { return save_package_.get(); } private: - TabContents* tab_contents_; + // TabContentsObserver overrides. + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // SavePackage, lazily created. scoped_refptr<SavePackage> save_package_; diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 21a95fb..b3cc6be 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -506,6 +506,9 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions, // The currently displayed PDF has an unsupported feature. IPC_MESSAGE_ROUTED0(ViewHostMsg_PDFHasUnsupportedFeature) +// Brings up SaveAs... dialog (similar to the wrench->SaveAs...). +IPC_MESSAGE_ROUTED0(ViewHostMsg_SaveAs) + // JavaScript related messages ----------------------------------------------- // Notify the JavaScript engine in the render to change its parameters diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index fda4d02..e819c56 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -1003,6 +1003,11 @@ void PepperPluginDelegateImpl::HasUnsupportedFeature() { render_view_->routing_id())); } +void PepperPluginDelegateImpl::SaveAs() { + render_view_->Send(new ViewHostMsg_SaveAs( + render_view_->routing_id())); +} + P2PSocketDispatcher* PepperPluginDelegateImpl::GetP2PSocketDispatcher() { return render_view_->p2p_socket_dispatcher(); } diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h index 6784efa..9554cdd 100644 --- a/content/renderer/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper_plugin_delegate_impl.h @@ -220,6 +220,7 @@ class PepperPluginDelegateImpl virtual void DidStopLoading(); virtual void SetContentRestriction(int restrictions); virtual void HasUnsupportedFeature(); + virtual void SaveAs(); virtual P2PSocketDispatcher* GetP2PSocketDispatcher(); virtual webkit_glue::P2PTransport* CreateP2PTransport(); diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h index ff1ee2b..f97afc3 100644 --- a/ppapi/c/private/ppb_pdf.h +++ b/ppapi/c/private/ppb_pdf.h @@ -23,9 +23,9 @@ typedef enum { } PP_ResourceString; typedef enum { - PP_RESOURCEIMAGE_PDF_BUTTON_FTH = 0, - PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER = 1, - PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED = 2, + PP_RESOURCEIMAGE_PDF_BUTTON_FTP = 0, + PP_RESOURCEIMAGE_PDF_BUTTON_FTP_HOVER = 1, + PP_RESOURCEIMAGE_PDF_BUTTON_FTP_PRESSED = 2, PP_RESOURCEIMAGE_PDF_BUTTON_FTW = 3, PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER = 4, PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED = 5, @@ -57,6 +57,12 @@ typedef enum { PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_8 = 31, PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_BACKGROUND = 32, PP_RESOURCEIMAGE_PDF_PAGE_DROPSHADOW = 33, + PP_RESOURCEIMAGE_PDF_BUTTON_SAVE = 34, + PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_HOVER = 35, + PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_PRESSED = 36, + PP_RESOURCEIMAGE_PDF_BUTTON_PRINT = 37, + PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_HOVER = 38, + PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_PRESSED = 39, } PP_ResourceImage; typedef enum { @@ -145,6 +151,9 @@ struct PPB_PDF { // Notifies the browser that the PDF has an unsupported feature. void (*HasUnsupportedFeature)(PP_Instance instance); + + // Invoke SaveAs... dialog, similar to the right-click or wrench menu. + void (*SaveAs)(PP_Instance instance); }; #endif // PPAPI_C_PRIVATE_PPB_PDF_H_ diff --git a/webkit/glue/resources/pdf_button_fth.png b/webkit/glue/resources/pdf_button_fth.png Binary files differdeleted file mode 100644 index 3b2cc9b..0000000 --- a/webkit/glue/resources/pdf_button_fth.png +++ /dev/null diff --git a/webkit/glue/resources/pdf_button_fth_hover.png b/webkit/glue/resources/pdf_button_fth_hover.png Binary files differdeleted file mode 100644 index 2904fd7..0000000 --- a/webkit/glue/resources/pdf_button_fth_hover.png +++ /dev/null diff --git a/webkit/glue/resources/pdf_button_fth_pressed.png b/webkit/glue/resources/pdf_button_fth_pressed.png Binary files differdeleted file mode 100644 index 6388c3a..0000000 --- a/webkit/glue/resources/pdf_button_fth_pressed.png +++ /dev/null diff --git a/webkit/glue/resources/pdf_button_ftp.png b/webkit/glue/resources/pdf_button_ftp.png Binary files differnew file mode 100644 index 0000000..06180b5 --- /dev/null +++ b/webkit/glue/resources/pdf_button_ftp.png diff --git a/webkit/glue/resources/pdf_button_ftp_hover.png b/webkit/glue/resources/pdf_button_ftp_hover.png Binary files differnew file mode 100644 index 0000000..e860119 --- /dev/null +++ b/webkit/glue/resources/pdf_button_ftp_hover.png diff --git a/webkit/glue/resources/pdf_button_ftp_pressed.png b/webkit/glue/resources/pdf_button_ftp_pressed.png Binary files differnew file mode 100644 index 0000000..8b00560 --- /dev/null +++ b/webkit/glue/resources/pdf_button_ftp_pressed.png diff --git a/webkit/glue/resources/pdf_button_ftw.png b/webkit/glue/resources/pdf_button_ftw.png Binary files differindex d4dacc5..6204843 100644 --- a/webkit/glue/resources/pdf_button_ftw.png +++ b/webkit/glue/resources/pdf_button_ftw.png diff --git a/webkit/glue/resources/pdf_button_ftw_hover.png b/webkit/glue/resources/pdf_button_ftw_hover.png Binary files differindex e5c98f4..e7a48ab 100644 --- a/webkit/glue/resources/pdf_button_ftw_hover.png +++ b/webkit/glue/resources/pdf_button_ftw_hover.png diff --git a/webkit/glue/resources/pdf_button_ftw_pressed.png b/webkit/glue/resources/pdf_button_ftw_pressed.png Binary files differindex 8db22b7..e300247 100644 --- a/webkit/glue/resources/pdf_button_ftw_pressed.png +++ b/webkit/glue/resources/pdf_button_ftw_pressed.png diff --git a/webkit/glue/resources/pdf_button_print.png b/webkit/glue/resources/pdf_button_print.png Binary files differnew file mode 100644 index 0000000..025eca1b --- /dev/null +++ b/webkit/glue/resources/pdf_button_print.png diff --git a/webkit/glue/resources/pdf_button_print_hover.png b/webkit/glue/resources/pdf_button_print_hover.png Binary files differnew file mode 100644 index 0000000..0328b19 --- /dev/null +++ b/webkit/glue/resources/pdf_button_print_hover.png diff --git a/webkit/glue/resources/pdf_button_print_pressed.png b/webkit/glue/resources/pdf_button_print_pressed.png Binary files differnew file mode 100644 index 0000000..c1148f5 --- /dev/null +++ b/webkit/glue/resources/pdf_button_print_pressed.png diff --git a/webkit/glue/resources/pdf_button_save.png b/webkit/glue/resources/pdf_button_save.png Binary files differnew file mode 100644 index 0000000..8848bac --- /dev/null +++ b/webkit/glue/resources/pdf_button_save.png diff --git a/webkit/glue/resources/pdf_button_save_hover.png b/webkit/glue/resources/pdf_button_save_hover.png Binary files differnew file mode 100644 index 0000000..a6f2527 --- /dev/null +++ b/webkit/glue/resources/pdf_button_save_hover.png diff --git a/webkit/glue/resources/pdf_button_save_pressed.png b/webkit/glue/resources/pdf_button_save_pressed.png Binary files differnew file mode 100644 index 0000000..237fad4 --- /dev/null +++ b/webkit/glue/resources/pdf_button_save_pressed.png diff --git a/webkit/glue/resources/pdf_button_zoomin.png b/webkit/glue/resources/pdf_button_zoomin.png Binary files differindex 3d399c6..f53382f 100644 --- a/webkit/glue/resources/pdf_button_zoomin.png +++ b/webkit/glue/resources/pdf_button_zoomin.png diff --git a/webkit/glue/resources/pdf_button_zoomin_hover.png b/webkit/glue/resources/pdf_button_zoomin_hover.png Binary files differindex 597f489..4534f2f 100644 --- a/webkit/glue/resources/pdf_button_zoomin_hover.png +++ b/webkit/glue/resources/pdf_button_zoomin_hover.png diff --git a/webkit/glue/resources/pdf_button_zoomin_pressed.png b/webkit/glue/resources/pdf_button_zoomin_pressed.png Binary files differindex 7847808..ecfa4bb 100644 --- a/webkit/glue/resources/pdf_button_zoomin_pressed.png +++ b/webkit/glue/resources/pdf_button_zoomin_pressed.png diff --git a/webkit/glue/resources/pdf_button_zoomout.png b/webkit/glue/resources/pdf_button_zoomout.png Binary files differindex c1b7c7c9..1c31809 100644 --- a/webkit/glue/resources/pdf_button_zoomout.png +++ b/webkit/glue/resources/pdf_button_zoomout.png diff --git a/webkit/glue/resources/pdf_button_zoomout_hover.png b/webkit/glue/resources/pdf_button_zoomout_hover.png Binary files differindex aa555cc..12009a5 100644 --- a/webkit/glue/resources/pdf_button_zoomout_hover.png +++ b/webkit/glue/resources/pdf_button_zoomout_hover.png diff --git a/webkit/glue/resources/pdf_button_zoomout_pressed.png b/webkit/glue/resources/pdf_button_zoomout_pressed.png Binary files differindex e16d8d6..fa922d74 100644 --- a/webkit/glue/resources/pdf_button_zoomout_pressed.png +++ b/webkit/glue/resources/pdf_button_zoomout_pressed.png diff --git a/webkit/glue/webkit_resources.grd b/webkit/glue/webkit_resources.grd index 20b684c..8d4f152 100644 --- a/webkit/glue/webkit_resources.grd +++ b/webkit/glue/webkit_resources.grd @@ -53,9 +53,9 @@ <include name="IDR_AUTOFILL_CC_MASTERCARD" file="resources\mastercard.png" type="BINDATA" /> <include name="IDR_AUTOFILL_CC_SOLO" file="resources\solo.png" type="BINDATA" /> <include name="IDR_AUTOFILL_CC_VISA" file="resources\visa.png" type="BINDATA" /> - <include name="IDR_PDF_BUTTON_FTH" file="resources\pdf_button_fth.png" type="BINDATA" /> - <include name="IDR_PDF_BUTTON_FTH_HOVER" file="resources\pdf_button_fth_hover.png" type="BINDATA" /> - <include name="IDR_PDF_BUTTON_FTH_PRESSED" file="resources\pdf_button_fth_pressed.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_FTP" file="resources\pdf_button_ftp.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_FTP_HOVER" file="resources\pdf_button_ftp_hover.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_FTP_PRESSED" file="resources\pdf_button_ftp_pressed.png" type="BINDATA" /> <include name="IDR_PDF_BUTTON_FTW" file="resources\pdf_button_ftw.png" type="BINDATA" /> <include name="IDR_PDF_BUTTON_FTW_HOVER" file="resources\pdf_button_ftw_hover.png" type="BINDATA" /> <include name="IDR_PDF_BUTTON_FTW_PRESSED" file="resources\pdf_button_ftw_pressed.png" type="BINDATA" /> @@ -65,6 +65,12 @@ <include name="IDR_PDF_BUTTON_ZOOMOUT" file="resources\pdf_button_zoomout.png" type="BINDATA" /> <include name="IDR_PDF_BUTTON_ZOOMOUT_HOVER" file="resources\pdf_button_zoomout_hover.png" type="BINDATA" /> <include name="IDR_PDF_BUTTON_ZOOMOUT_PRESSED" file="resources\pdf_button_zoomout_pressed.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_SAVE" file="resources\pdf_button_save.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_SAVE_HOVER" file="resources\pdf_button_save_hover.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_SAVE_PRESSED" file="resources\pdf_button_save_pressed.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_PRINT" file="resources\pdf_button_print.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_PRINT_HOVER" file="resources\pdf_button_print_hover.png" type="BINDATA" /> + <include name="IDR_PDF_BUTTON_PRINT_PRESSED" file="resources\pdf_button_print_pressed.png" type="BINDATA" /> <include name="IDR_PDF_THUMBNAIL_0" file="resources\pdf_thumbnail_0.png" type="BINDATA" /> <include name="IDR_PDF_THUMBNAIL_1" file="resources\pdf_thumbnail_1.png" type="BINDATA" /> <include name="IDR_PDF_THUMBNAIL_2" file="resources\pdf_thumbnail_2.png" type="BINDATA" /> diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index e896bcd..a893956 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -219,6 +219,9 @@ void MockPluginDelegate::SetContentRestriction(int restrictions) { void MockPluginDelegate::HasUnsupportedFeature() { } +void MockPluginDelegate::SaveAs() { +} + P2PSocketDispatcher* MockPluginDelegate::GetP2PSocketDispatcher() { return NULL; } diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 101f788..557d7f3 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -96,6 +96,7 @@ class MockPluginDelegate : public PluginDelegate { virtual void DidStopLoading(); virtual void SetContentRestriction(int restrictions); virtual void HasUnsupportedFeature(); + virtual void SaveAs(); virtual P2PSocketDispatcher* GetP2PSocketDispatcher(); virtual webkit_glue::P2PTransport* CreateP2PTransport(); }; diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index a3eaf56..68a6471 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -372,6 +372,9 @@ class PluginDelegate { // Tells the browser that the PDF has an unsupported feature. virtual void HasUnsupportedFeature() = 0; + // Tells the browser to bring up SaveAs dialog. + virtual void SaveAs() = 0; + // Socket dispatcher for P2P connections. Returns to NULL if P2P API // is disabled. // diff --git a/webkit/plugins/ppapi/ppb_pdf_impl.cc b/webkit/plugins/ppapi/ppb_pdf_impl.cc index f26cc18..9316e3a 100644 --- a/webkit/plugins/ppapi/ppb_pdf_impl.cc +++ b/webkit/plugins/ppapi/ppb_pdf_impl.cc @@ -55,9 +55,9 @@ struct ResourceImageInfo { }; static const ResourceImageInfo kResourceImageMap[] = { - { PP_RESOURCEIMAGE_PDF_BUTTON_FTH, IDR_PDF_BUTTON_FTH }, - { PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER, IDR_PDF_BUTTON_FTH_HOVER }, - { PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED, IDR_PDF_BUTTON_FTH_PRESSED }, + { PP_RESOURCEIMAGE_PDF_BUTTON_FTP, IDR_PDF_BUTTON_FTP }, + { PP_RESOURCEIMAGE_PDF_BUTTON_FTP_HOVER, IDR_PDF_BUTTON_FTP_HOVER }, + { PP_RESOURCEIMAGE_PDF_BUTTON_FTP_PRESSED, IDR_PDF_BUTTON_FTP_PRESSED }, { PP_RESOURCEIMAGE_PDF_BUTTON_FTW, IDR_PDF_BUTTON_FTW }, { PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER, IDR_PDF_BUTTON_FTW_HOVER }, { PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED, IDR_PDF_BUTTON_FTW_PRESSED }, @@ -68,6 +68,12 @@ static const ResourceImageInfo kResourceImageMap[] = { { PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER, IDR_PDF_BUTTON_ZOOMOUT_HOVER }, { PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED, IDR_PDF_BUTTON_ZOOMOUT_PRESSED }, + { PP_RESOURCEIMAGE_PDF_BUTTON_SAVE, IDR_PDF_BUTTON_SAVE }, + { PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_HOVER, IDR_PDF_BUTTON_SAVE_HOVER }, + { PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_PRESSED, IDR_PDF_BUTTON_SAVE_PRESSED }, + { PP_RESOURCEIMAGE_PDF_BUTTON_PRINT, IDR_PDF_BUTTON_PRINT }, + { PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_HOVER, IDR_PDF_BUTTON_PRINT_HOVER }, + { PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_PRESSED, IDR_PDF_BUTTON_PRINT_PRESSED }, { PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0, IDR_PDF_THUMBNAIL_0 }, { PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1, IDR_PDF_THUMBNAIL_1 }, { PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2, IDR_PDF_THUMBNAIL_2 }, @@ -294,6 +300,13 @@ void HasUnsupportedFeature(PP_Instance instance_id) { instance->delegate()->HasUnsupportedFeature(); } +void SaveAs(PP_Instance instance_id) { + PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); + if (!instance) + return; + instance->delegate()->SaveAs(); +} + const PPB_PDF ppb_pdf = { &GetLocalizedString, &GetResourceImage, @@ -305,7 +318,8 @@ const PPB_PDF ppb_pdf = { &SetContentRestriction, &HistogramPDFPageCount, &UserMetricsRecordAction, - &HasUnsupportedFeature + &HasUnsupportedFeature, + &SaveAs }; } // namespace |