]> khamidou — GitHub mirrors - electron.git/commitdiff
Add `donwloadItem.getContentDisposition()` API.
authorHaojian Wu <hokein.wu@gmail.com>
Mon, 21 Sep 2015 01:38:38 +0000 (09:38 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Mon, 21 Sep 2015 01:38:38 +0000 (09:38 +0800)
atom/browser/api/atom_api_download_item.cc
atom/browser/api/atom_api_download_item.h
docs/api/download-item.md

index 2e3068a5d3ccea63a4cb30a21a968a34072a6282..b056695a20b540b6243fdc88972cc41a25f4ac18 100644 (file)
@@ -71,6 +71,10 @@ std::string DownloadItem::GetSuggestedFilename() {
   return download_item_->GetSuggestedFilename();
 }
 
+std::string DownloadItem::GetContentDisposition() {
+  return download_item_->GetContentDisposition();
+}
+
 void DownloadItem::Pause() {
   download_item_->Pause();
 }
@@ -94,7 +98,8 @@ mate::ObjectTemplateBuilder DownloadItem::GetObjectTemplateBuilder(
       .SetMethod("getURL", &DownloadItem::GetURL)
       .SetMethod("getMimeType", &DownloadItem::GetMimeType)
       .SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
-      .SetMethod("getSuggestedFilename", &DownloadItem::GetSuggestedFilename);
+      .SetMethod("getSuggestedFilename", &DownloadItem::GetSuggestedFilename)
+      .SetMethod("getContentDisposition", &DownloadItem::GetContentDisposition);
 }
 
 void SetWrapDownloadItem(const WrapDownloadItemCallback& callback) {
index ca87a14ae80f581f4d2e9b16a9cc92a5dc7aaf8d..e12064c825eca9fb8e05507d1beee3e86266e1dc 100644 (file)
@@ -36,6 +36,7 @@ class DownloadItem : public mate::TrackableObject<DownloadItem>,
   std::string GetMimeType();
   bool HasUserGesture();
   std::string GetSuggestedFilename();
+  std::string GetContentDisposition();
   const GURL& GetURL();
 
  private:
index eacff629467f748bded1a22e1ecd47b2708b9294..afbc4aea3646685f538aca295e533d3c1ccd8c48 100644 (file)
@@ -81,3 +81,8 @@ Returns a `Integer` represents the total size in bytes of the download item.
 ### `downloadItem.getReceivedBytes()`
 
 Returns a `Integer` represents the received bytes of the download item.
+
+### `downloadItem.getContentDisposition()`
+
+Returns a `String` represents the Content-Disposition field from the response
+header.