diff options
-rw-r--r-- | chrome/browser/ui/download/download_tab_helper.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/download/download_tab_helper.h | 4 | ||||
-rw-r--r-- | content/common/view_messages.h | 5 | ||||
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.cc | 6 | ||||
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.h | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_pdf_impl.cc | 2 |
9 files changed, 22 insertions, 12 deletions
diff --git a/chrome/browser/ui/download/download_tab_helper.cc b/chrome/browser/ui/download/download_tab_helper.cc index c7a5fee..04eebc0 100644 --- a/chrome/browser/ui/download/download_tab_helper.cc +++ b/chrome/browser/ui/download/download_tab_helper.cc @@ -41,6 +41,11 @@ void DownloadTabHelper::OnSavePage() { save_package_->GetSaveInfo(); } +void DownloadTabHelper::OnSaveURL(const GURL& url) { + DownloadManager* dlm = tab_contents()->profile()->GetDownloadManager(); + dlm->DownloadUrl(url, tab_contents()->GetURL(), "", tab_contents()); +} + // Used in automated testing to bypass prompting the user for file names. // Instead, the names and paths are hard coded rather than running them through // file name sanitation and extension / mime checking. @@ -58,7 +63,7 @@ bool DownloadTabHelper::SavePage(const FilePath& main_file, bool DownloadTabHelper::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(DownloadTabHelper, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_SaveAs, OnSavePage) + IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/chrome/browser/ui/download/download_tab_helper.h b/chrome/browser/ui/download/download_tab_helper.h index 6bd104b..77ac07a 100644 --- a/chrome/browser/ui/download/download_tab_helper.h +++ b/chrome/browser/ui/download/download_tab_helper.h @@ -20,6 +20,10 @@ class DownloadTabHelper : public TabContentsObserver { // Prepare for saving the current web page to disk. void OnSavePage(); + // Prepare for saving the URL to disk. + // URL may refer to the iframe on the page. + void OnSaveURL(const GURL& url); + // Save page with the main HTML file path, the directory for saving resources, // and the save type: HTML only or complete web page. Returns true if the // saving process has been initiated successfully. diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 140267e..4602f17 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1941,8 +1941,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) +// Brings up SaveAs... dialog to save specified URL. +IPC_MESSAGE_ROUTED1(ViewHostMsg_SaveURLAs, + GURL /* url */) // Notifies when default plugin updates status of the missing plugin. IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus, diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index 1b1acf7..31bdc50 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -1170,9 +1170,9 @@ void PepperPluginDelegateImpl::HasUnsupportedFeature() { render_view_->routing_id())); } -void PepperPluginDelegateImpl::SaveAs() { - render_view_->Send(new ViewHostMsg_SaveAs( - render_view_->routing_id())); +void PepperPluginDelegateImpl::SaveURLAs(const GURL& url) { + render_view_->Send(new ViewHostMsg_SaveURLAs( + render_view_->routing_id(), url)); } P2PSocketDispatcher* PepperPluginDelegateImpl::GetP2PSocketDispatcher() { diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h index dafafff..e337b2c 100644 --- a/content/renderer/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper_plugin_delegate_impl.h @@ -249,7 +249,7 @@ class PepperPluginDelegateImpl virtual void DidStopLoading(); virtual void SetContentRestriction(int restrictions); virtual void HasUnsupportedFeature(); - virtual void SaveAs(); + virtual void SaveURLAs(const GURL& url); virtual P2PSocketDispatcher* GetP2PSocketDispatcher(); virtual webkit_glue::P2PTransport* CreateP2PTransport(); diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index b0185ab..4ac0a00 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -224,7 +224,7 @@ void MockPluginDelegate::SetContentRestriction(int restrictions) { void MockPluginDelegate::HasUnsupportedFeature() { } -void MockPluginDelegate::SaveAs() { +void MockPluginDelegate::SaveURLAs(const GURL& url) { } P2PSocketDispatcher* MockPluginDelegate::GetP2PSocketDispatcher() { diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 98f769f..32b80c7 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -99,7 +99,7 @@ class MockPluginDelegate : public PluginDelegate { virtual void DidStopLoading(); virtual void SetContentRestriction(int restrictions); virtual void HasUnsupportedFeature(); - virtual void SaveAs(); + virtual void SaveURLAs(const GURL& url); 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 212889a..eefb1e6 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -375,8 +375,8 @@ 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; + // Tells the browser to bring up SaveAs dialog to save specified URL. + virtual void SaveURLAs(const GURL& url) = 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 9316e3a..f58b823 100644 --- a/webkit/plugins/ppapi/ppb_pdf_impl.cc +++ b/webkit/plugins/ppapi/ppb_pdf_impl.cc @@ -304,7 +304,7 @@ void SaveAs(PP_Instance instance_id) { PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); if (!instance) return; - instance->delegate()->SaveAs(); + instance->delegate()->SaveURLAs(instance->plugin_url()); } const PPB_PDF ppb_pdf = { |