summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-05 11:02:28 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-05 11:02:28 +0000
commit1751060747a9e311f54b3c60ae1f90a2b24db8e4 (patch)
tree92deb0a990deea2d27e9cb953999ab1703a4e256 /chrome/browser/download
parent89632bd2667c892706c38173f06d5ac54606be84 (diff)
downloadchromium_src-1751060747a9e311f54b3c60ae1f90a2b24db8e4.zip
chromium_src-1751060747a9e311f54b3c60ae1f90a2b24db8e4.tar.gz
chromium_src-1751060747a9e311f54b3c60ae1f90a2b24db8e4.tar.bz2
Android: Eliminate alarms, downloads, and omnibox extensions code.
BUG=305852 Review URL: https://codereview.chromium.org/300573005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275062 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r--chrome/browser/download/chrome_download_manager_delegate.cc19
-rw-r--r--chrome/browser/download/chrome_download_manager_delegate.h4
-rw-r--r--chrome/browser/download/download_history.cc6
-rw-r--r--chrome/browser/download/download_history_unittest.cc4
-rw-r--r--chrome/browser/download/download_service.cc9
-rw-r--r--chrome/browser/download/download_service.h4
6 files changed, 30 insertions, 16 deletions
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 4c27ba6..1134636 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -33,9 +33,6 @@
#include "chrome/browser/download/download_stats.h"
#include "chrome/browser/download/download_target_determiner.h"
#include "chrome/browser/download/save_package_file_picker.h"
-#include "chrome/browser/extensions/api/downloads/downloads_api.h"
-#include "chrome/browser/extensions/crx_installer.h"
-#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
@@ -49,7 +46,6 @@
#include "content/public/browser/download_manager.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/page_navigator.h"
-#include "extensions/common/constants.h"
#include "net/base/filename_util.h"
#include "net/base/mime_util.h"
@@ -58,6 +54,13 @@
#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/browser/extensions/api/downloads/downloads_api.h"
+#include "chrome/browser/extensions/crx_installer.h"
+#include "chrome/browser/extensions/webstore_installer.h"
+#include "extensions/common/constants.h"
+#endif
+
using content::BrowserThread;
using content::DownloadItem;
using content::DownloadManager;
@@ -295,11 +298,13 @@ bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (path.Extension().empty())
return false;
+#if defined(ENABLE_EXTENSIONS)
// TODO(asanka): This determination is done based on |path|, while
// ShouldOpenDownload() detects extension downloads based on the
// characteristics of the download. Reconcile this. http://crbug.com/167702
if (path.MatchesExtension(extensions::kExtensionFileExtension))
return false;
+#endif
return download_prefs_->IsAutoOpenEnabledBasedOnExtension(path);
}
@@ -370,6 +375,7 @@ bool ChromeDownloadManagerDelegate::ShouldCompleteDownload(
bool ChromeDownloadManagerDelegate::ShouldOpenDownload(
DownloadItem* item, const content::DownloadOpenDelayedCallback& callback) {
+#if defined(ENABLE_EXTENSIONS)
if (download_crx_util::IsExtensionDownload(*item) &&
!extensions::WebstoreInstaller::GetAssociatedApproval(*item)) {
scoped_refptr<extensions::CrxInstaller> crx_installer =
@@ -389,6 +395,7 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload(
item->UpdateObservers();
return false;
}
+#endif
return true;
}
@@ -535,7 +542,7 @@ void ChromeDownloadManagerDelegate::NotifyExtensions(
const base::FilePath& virtual_path,
const NotifyExtensionsCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionDownloadsEventRouter* router =
DownloadServiceFactory::GetForBrowserContext(profile_)
->GetExtensionEventRouter();
@@ -684,6 +691,7 @@ void ChromeDownloadManagerDelegate::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+#if defined(ENABLE_EXTENSIONS)
DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE);
registrar_.Remove(this,
@@ -696,6 +704,7 @@ void ChromeDownloadManagerDelegate::Observe(
crx_installers_[installer.get()];
crx_installers_.erase(installer.get());
callback.Run(installer->did_handle_successfully());
+#endif
}
void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h
index 095f391..7cf2c45 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.h
+++ b/chrome/browser/download/chrome_download_manager_delegate.h
@@ -34,7 +34,7 @@ namespace user_prefs {
class PrefRegistrySyncable;
}
-#if defined(COMPILER_GCC)
+#if defined(COMPILER_GCC) && defined(ENABLE_EXTENSIONS)
namespace BASE_HASH_NAMESPACE {
template<>
struct hash<extensions::CrxInstaller*> {
@@ -175,10 +175,12 @@ class ChromeDownloadManagerDelegate
IdCallbackVector id_callbacks_;
scoped_ptr<DownloadPrefs> download_prefs_;
+#if defined(ENABLE_EXTENSIONS)
// Maps from pending extension installations to DownloadItem IDs.
typedef base::hash_map<extensions::CrxInstaller*,
content::DownloadOpenDelayedCallback> CrxInstallerMap;
CrxInstallerMap crx_installers_;
+#endif
content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc
index 10b9be6..112ecac 100644
--- a/chrome/browser/download/download_history.cc
+++ b/chrome/browser/download/download_history.cc
@@ -37,7 +37,7 @@
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager.h"
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/downloads/downloads_api.h"
#endif
@@ -114,7 +114,7 @@ const char DownloadHistoryData::kKey[] =
history::DownloadRow GetDownloadRow(
content::DownloadItem* item) {
std::string by_ext_id, by_ext_name;
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
extensions::DownloadedByExtension* by_ext =
extensions::DownloadedByExtension::Get(item);
if (by_ext) {
@@ -272,7 +272,7 @@ void DownloadHistory::QueryCallback(scoped_ptr<InfoVector> infos) {
it->danger_type,
it->interrupt_reason,
it->opened);
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
if (!it->by_ext_id.empty() && !it->by_ext_name.empty()) {
new extensions::DownloadedByExtension(
item, it->by_ext_id, it->by_ext_name);
diff --git a/chrome/browser/download/download_history_unittest.cc b/chrome/browser/download/download_history_unittest.cc
index 81568b9..22059d4 100644
--- a/chrome/browser/download/download_history_unittest.cc
+++ b/chrome/browser/download/download_history_unittest.cc
@@ -18,7 +18,7 @@
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/downloads/downloads_api.h"
#endif
@@ -444,7 +444,7 @@ class DownloadHistoryTest : public testing::Test {
EXPECT_CALL(manager(), GetDownload(id))
.WillRepeatedly(Return(&item(index)));
EXPECT_CALL(item(index), IsTemporary()).WillRepeatedly(Return(false));
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
new extensions::DownloadedByExtension(
&item(index), by_extension_id, by_extension_name);
#endif
diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc
index e4b2961..f69dcc4 100644
--- a/chrome/browser/download/download_service.cc
+++ b/chrome/browser/download/download_service.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_status_updater.h"
#include "chrome/browser/download/download_ui_controller.h"
-#include "chrome/browser/extensions/api/downloads/downloads_api.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/net/chrome_net_log.h"
@@ -19,6 +18,10 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "content/public/browser/download_manager.h"
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/browser/extensions/api/downloads/downloads_api.h"
+#endif
+
using content::BrowserContext;
using content::DownloadManager;
using content::DownloadManagerDelegate;
@@ -47,7 +50,7 @@ ChromeDownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() {
manager_delegate_->SetDownloadManager(manager);
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
extension_event_router_.reset(
new extensions::ExtensionDownloadsEventRouter(profile_, manager));
#endif
@@ -169,7 +172,7 @@ void DownloadService::Shutdown() {
// manually earlier. See http://crbug.com/131692
BrowserContext::GetDownloadManager(profile_)->Shutdown();
}
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
extension_event_router_.reset();
#endif
manager_delegate_.reset();
diff --git a/chrome/browser/download/download_service.h b/chrome/browser/download/download_service.h
index 19ad3fb..dbd32f0 100644
--- a/chrome/browser/download/download_service.h
+++ b/chrome/browser/download/download_service.h
@@ -38,7 +38,7 @@ class DownloadService : public KeyedService {
// no HistoryService for profile. Virtual for testing.
virtual DownloadHistory* GetDownloadHistory();
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionDownloadsEventRouter* GetExtensionEventRouter() {
return extension_event_router_.get();
}
@@ -96,7 +96,7 @@ class DownloadService : public KeyedService {
// Once we have extensions on android, we probably need the EventRouter
// in ContentViewDownloadDelegate which knows about both GET and POST
// downloads.
-#if !defined(OS_ANDROID)
+#if defined(ENABLE_EXTENSIONS)
// The ExtensionDownloadsEventRouter dispatches download creation, change, and
// erase events to extensions. Like ChromeDownloadManagerDelegate, it's a
// chrome-level concept and its lifetime should match DownloadManager. There