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

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

Issue 1365963004: Don't compile download notification code on !CrOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo fix Created 5 years, 3 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/download_ui_controller.cc
diff --git a/chrome/browser/download/download_ui_controller.cc b/chrome/browser/download/download_ui_controller.cc
index ae197a84cb20182f7f4803728ad6b461202d9264..c21aa817a64c5502d61716bf12e60a4cb6efa54f 100644
--- a/chrome/browser/download/download_ui_controller.cc
+++ b/chrome/browser/download/download_ui_controller.cc
@@ -19,12 +19,15 @@
#if defined(OS_ANDROID)
#include "content/public/browser/android/download_controller_android.h"
#else
-#include "chrome/browser/download/notification/download_notification_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/host_desktop.h"
#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/download/notification/download_notification_manager.h"
+#endif
+
namespace {
// DownloadShelfUIControllerDelegate{Android,} is used when a
@@ -104,22 +107,23 @@ DownloadUIController::DownloadUIController(content::DownloadManager* manager,
scoped_ptr<Delegate> delegate)
: download_notifier_(manager, this),
delegate_(delegate.Pass()) {
- if (!delegate_) {
#if defined(OS_ANDROID)
+ if (!delegate_)
delegate_.reset(new AndroidUIControllerDelegate());
#else
- // The delegate should not be invoked after the profile has gone away. This
- // should be the case since DownloadUIController is owned by
- // DownloadService, which in turn is a profile keyed service.
- if (DownloadNotificationManager::IsEnabled()) {
- delegate_.reset(new DownloadNotificationManager(
- Profile::FromBrowserContext(manager->GetBrowserContext())));
- } else {
- delegate_.reset(new DownloadShelfUIControllerDelegate(
- Profile::FromBrowserContext(manager->GetBrowserContext())));
- }
-#endif
+#if defined(OS_CHROMEOS)
+ if (!delegate_ && DownloadNotificationManager::IsEnabled()) {
+ // The Profile is guaranteed to be valid since DownloadUIController is owned
+ // by DownloadService, which in turn is a profile keyed service.
+ delegate_.reset(new DownloadNotificationManager(
+ Profile::FromBrowserContext(manager->GetBrowserContext())));
yoshiki 2015/09/25 18:14:35 Please set |DownloadShelfUIControllerDelegate| to
Evan Stade 2015/09/25 19:06:53 not 100% sure I follow your meaning, but I think t
yoshiki 2015/09/25 23:35:31 Sorry, you're correct. Please ignore my comment.
+ }
+#endif // defined(OS_CHROMEOS)
+ if (!delegate_) {
+ delegate_.reset(new DownloadShelfUIControllerDelegate(
+ Profile::FromBrowserContext(manager->GetBrowserContext())));
}
+#endif // defined(OS_ANDROID)
}
DownloadUIController::~DownloadUIController() {
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/notification/download_item_notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698