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 /webkit/plugins | |
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
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_pdf_impl.cc | 22 |
4 files changed, 25 insertions, 4 deletions
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 |