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

Unified 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: 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
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 8ed2395f84d39bf0591f7fe31b747dfc334698c3..a6da0f21f4d2f2299fcbeff78c8a82bf3d658e41 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -392,6 +392,35 @@ bool ChromeDownloadManagerDelegate::ShouldOpenWithWebIntents(
}
#endif // defined(OS_CHROMEOS)
+ // If QuickOffice extension is installed, use web intents to handle the
+ // downloaded file.
+ const char* kQuickOfficeExtensionId = "gbkeegbaiigmenfmjfclcdgdpimamgkj";
+ ExtensionServiceInterface* extension_service =
+ profile_->GetExtensionService();
+
+ const ExtensionSet* set = extension_service->extensions();
+ for (ExtensionSet::const_iterator it = set->begin();
+ it != set->end(); ++it) {
+ LOG(INFO) << "Have extension " << (*it)->id();
+ }
+
+ if (extension_service &&
+ extension_service->GetInstalledExtension(kQuickOfficeExtensionId) &&
+ extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) {
+ LOG(INFO) << "Adding office type policy!";
+ if (mime_type == "application/msword" ||
+ mime_type == "application/vnd.ms-powerpoint" ||
+ mime_type == "application/vnd.ms-excel" ||
+ mime_type == "application/vnd.openxmlformats-officedocument."
+ "wordprocessingml.document" ||
+ mime_type == "application/vnd.openxmlformats-officedocument."
+ "presentationml.presentation" ||
+ mime_type == "application/vnd.openxmlformats-officedocument."
+ "spreadsheetml.sheet") {
+ return true;
+ }
+ }
+
return false;
}
« no previous file with comments | « no previous file | chrome/browser/intents/web_intents_registry.cc » ('j') | chrome/browser/intents/web_intents_registry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698