Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1715)

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 10880074: Don't prompt for directory on web intents downloads; handle in current tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add delivery browser check Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index f3e7c054241574c09632573c425fed64a7f8c135..f64b08226cc37bcb7795f37204fa9912e68c0832 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/extensions/api/downloads/downloads_api.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/intents/web_intents_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
@@ -369,7 +370,7 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) {
bool ChromeDownloadManagerDelegate::ShouldOpenWithWebIntents(
const DownloadItem* item) {
- if (!item->GetWebContents() || !item->GetWebContents()->GetDelegate())
+ if (web_intents::GetBrowserForBackgroundWebIntentDelivery(profile_) == NULL)
benjhayden 2012/08/28 19:13:06 if (!web_intents::...(...)) instead of explicit co
Greg Billock 2012/09/07 18:52:34 Done.
return false;
std::string mime_type = item->GetMimeType();
@@ -436,10 +437,16 @@ void ChromeDownloadManagerDelegate::OpenWithWebIntent(
content::WebIntentsDispatcher* dispatcher =
content::WebIntentsDispatcher::Create(intent_data);
- // TODO(gbillock): try to get this to be able to delegate to the Browser
- // object directly, passing a NULL WebContents?
- item->GetWebContents()->GetDelegate()->WebIntentDispatch(
- item->GetWebContents(), dispatcher);
+
+ content::WebContentsDelegate* delegate = NULL;
+ if (item->GetWebContents() && item->GetWebContents()->GetDelegate()) {
+ delegate = item->GetWebContents()->GetDelegate();
+ } else {
+ delegate = web_intents::GetBrowserForBackgroundWebIntentDelivery(
+ profile_);
+ }
+ if (delegate)
+ delegate->WebIntentDispatch(NULL, dispatcher);
}
bool ChromeDownloadManagerDelegate::GenerateFileHash() {
@@ -709,6 +716,8 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone(
}
if (download_prefs_->IsDownloadPathManaged())
should_prompt = false;
+ if (ShouldOpenWithWebIntents(download))
+ should_prompt = false;
// Determine the proper path for a download, by either one of the following:
// 1) using the default download directory.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698