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

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

Issue 10830363: intents: Add conditional web intents dispatch for docs types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kill superfluous logging. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/intents/web_intents_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 mime_type == "application/vnd.openxmlformats-officedocument." 385 mime_type == "application/vnd.openxmlformats-officedocument."
386 "wordprocessingml.document" || 386 "wordprocessingml.document" ||
387 mime_type == "application/vnd.openxmlformats-officedocument." 387 mime_type == "application/vnd.openxmlformats-officedocument."
388 "presentationml.presentation" || 388 "presentationml.presentation" ||
389 mime_type == "application/vnd.openxmlformats-officedocument." 389 mime_type == "application/vnd.openxmlformats-officedocument."
390 "spreadsheetml.sheet") { 390 "spreadsheetml.sheet") {
391 return true; 391 return true;
392 } 392 }
393 #endif // defined(OS_CHROMEOS) 393 #endif // defined(OS_CHROMEOS)
394 394
395 // If QuickOffice extension is installed, use web intents to handle the
396 // downloaded file.
397 const char* kQuickOfficeExtensionId = "gbkeegbaiigmenfmjfclcdgdpimamgkj";
Steve McKay 2012/08/16 22:36:17 The five or so lines of code dedicated to figuring
398 ExtensionServiceInterface* extension_service =
399 profile_->GetExtensionService();
400 if (extension_service &&
401 extension_service->GetInstalledExtension(kQuickOfficeExtensionId) &&
402 extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) {
403 if (mime_type == "application/msword" ||
404 mime_type == "application/vnd.ms-powerpoint" ||
405 mime_type == "application/vnd.ms-excel" ||
406 mime_type == "application/vnd.openxmlformats-officedocument."
407 "wordprocessingml.document" ||
408 mime_type == "application/vnd.openxmlformats-officedocument."
409 "presentationml.presentation" ||
410 mime_type == "application/vnd.openxmlformats-officedocument."
411 "spreadsheetml.sheet") {
412 return true;
413 }
groby-ooo-7-16 2012/08/16 22:10:39 Can we actually unify that with the chromeos code?
414 }
415
395 return false; 416 return false;
396 } 417 }
397 418
398 void ChromeDownloadManagerDelegate::OpenWithWebIntent( 419 void ChromeDownloadManagerDelegate::OpenWithWebIntent(
399 const DownloadItem* item) { 420 const DownloadItem* item) {
400 webkit_glue::WebIntentData intent_data( 421 webkit_glue::WebIntentData intent_data(
401 ASCIIToUTF16("http://webintents.org/view"), 422 ASCIIToUTF16("http://webintents.org/view"),
402 ASCIIToUTF16(item->GetMimeType()), 423 ASCIIToUTF16(item->GetMimeType()),
403 item->GetFullPath(), 424 item->GetFullPath(),
404 item->GetReceivedBytes()); 425 item->GetReceivedBytes());
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 int32 download_id, int64 db_handle) { 856 int32 download_id, int64 db_handle) {
836 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 857 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
837 // call this function with an invalid |db_handle|. For instance, this can 858 // call this function with an invalid |db_handle|. For instance, this can
838 // happen when the history database is offline. We cannot have multiple 859 // happen when the history database is offline. We cannot have multiple
839 // DownloadItems with the same invalid db_handle, so we need to assign a 860 // DownloadItems with the same invalid db_handle, so we need to assign a
840 // unique |db_handle| here. 861 // unique |db_handle| here.
841 if (db_handle == DownloadItem::kUninitializedHandle) 862 if (db_handle == DownloadItem::kUninitializedHandle)
842 db_handle = download_history_->GetNextFakeDbHandle(); 863 db_handle = download_history_->GetNextFakeDbHandle();
843 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 864 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
844 } 865 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/intents/web_intents_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698