web_contents()->GetController().LoadURLWithParams(params);
}
+void WebContents::DownloadURL(const GURL& url) {
+ auto browser_context = web_contents()->GetBrowserContext();
+ auto download_manager =
+ content::BrowserContext::GetDownloadManager(browser_context);
+
+ download_manager->DownloadUrl(
+ content::DownloadUrlParameters::FromWebContents(web_contents(), url));
+}
+
GURL WebContents::GetURL() const {
return web_contents()->GetURL();
}
.SetMethod("getId", &WebContents::GetID)
.SetMethod("equal", &WebContents::Equal)
.SetMethod("_loadURL", &WebContents::LoadURL)
+ .SetMethod("downloadURL", &WebContents::DownloadURL)
.SetMethod("_getURL", &WebContents::GetURL)
.SetMethod("getTitle", &WebContents::GetTitle)
.SetMethod("isLoading", &WebContents::IsLoading)
int GetID() const;
bool Equal(const WebContents* web_contents) const;
void LoadURL(const GURL& url, const mate::Dictionary& options);
+ void DownloadURL(const GURL& url);
GURL GetURL() const;
base::string16 GetTitle() const;
bool IsLoading() const;