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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 9651020: Pass content-type resources to web intents. Goes through download, then invokes the p… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move dispatch logic client-side. Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::Bind( 201 base::Bind(
202 &ChromeDownloadManagerDelegate::CheckClientDownloadDone, 202 &ChromeDownloadManagerDelegate::CheckClientDownloadDone,
203 this, 203 this,
204 item->GetId())); 204 item->GetId()));
205 return false; 205 return false;
206 } 206 }
207 #endif 207 #endif
208 return true; 208 return true;
209 } 209 }
210 210
211 bool ChromeDownloadManagerDelegate::ShouldOpenWithWebIntent(
212 DownloadItem* item) {
213 std::string mime_type = item->GetMimeType();
214 LOG(INFO) << "Testing " << mime_type << " for web intents";
215
216 // TODO: Check for explicit user-caused download?
217
218 if (mime_type == "application/rss+xml" ||
jam 2012/03/16 21:36:26 why is this stuff in chrome?
Greg Billock 2012/03/18 00:32:21 This method is basically a policy delegation to th
219 mime_type == "application/atom+xml" ||
220 mime_type == "application/ms-word" ||
221 mime_type == "application/pdf") {
222 return true;
223 }
224
225 return false;
226 }
227
211 bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) { 228 bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) {
212 if (!IsExtensionDownload(item)) { 229 if (!IsExtensionDownload(item)) {
213 return true; 230 return true;
214 } 231 }
215 232
216 scoped_refptr<CrxInstaller> crx_installer = 233 scoped_refptr<CrxInstaller> crx_installer =
217 download_crx_util::OpenChromeExtension(profile_, *item); 234 download_crx_util::OpenChromeExtension(profile_, *item);
218 235
219 // CRX_INSTALLER_DONE will fire when the install completes. Observe() 236 // CRX_INSTALLER_DONE will fire when the install completes. Observe()
220 // will call DelayedDownloadOpened() on this item. If this DownloadItem is 237 // will call DelayedDownloadOpened() on this item. If this DownloadItem is
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 int32 download_id, int64 db_handle) { 622 int32 download_id, int64 db_handle) {
606 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 623 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
607 // call this function with an invalid |db_handle|. For instance, this can 624 // call this function with an invalid |db_handle|. For instance, this can
608 // happen when the history database is offline. We cannot have multiple 625 // happen when the history database is offline. We cannot have multiple
609 // DownloadItems with the same invalid db_handle, so we need to assign a 626 // DownloadItems with the same invalid db_handle, so we need to assign a
610 // unique |db_handle| here. 627 // unique |db_handle| here.
611 if (db_handle == DownloadItem::kUninitializedHandle) 628 if (db_handle == DownloadItem::kUninitializedHandle)
612 db_handle = download_history_->GetNextFakeDbHandle(); 629 db_handle = download_history_->GetNextFakeDbHandle();
613 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 630 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
614 } 631 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698