OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/notification/download_notification_manager.h" | 5 #include "chrome/browser/download/notification/download_notification_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
11 #include "chrome/browser/download/notification/download_group_notification.h" | 11 #include "chrome/browser/download/notification/download_group_notification.h" |
12 #include "chrome/browser/download/notification/download_item_notification.h" | 12 #include "chrome/browser/download/notification/download_item_notification.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
15 #include "content/public/browser/download_item.h" | 15 #include "content/public/browser/download_item.h" |
16 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/message_center/message_center.h" | 19 #include "ui/message_center/message_center.h" |
20 #include "ui/message_center/notification.h" | 20 #include "ui/message_center/notification.h" |
21 #include "ui/message_center/notification_delegate.h" | 21 #include "ui/message_center/notification_delegate.h" |
22 | 22 |
23 /////////////////////////////////////////////////////////////////////////////// | 23 /////////////////////////////////////////////////////////////////////////////// |
24 // DownloadNotificationManager implementation: | 24 // DownloadNotificationManager implementation: |
25 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
26 | 26 |
27 bool DownloadNotificationManager::IsEnabled() { | 27 bool DownloadNotificationManager::IsEnabled() { |
28 #if defined(OS_CHROMEOS) | 28 // Disabled by default. |
29 bool enable_download_notification = true; | |
30 #else | |
31 bool enable_download_notification = false; | 29 bool enable_download_notification = false; |
32 #endif | |
33 | 30 |
34 std::string arg = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 31 std::string arg = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
35 switches::kEnableDownloadNotification); | 32 switches::kEnableDownloadNotification); |
36 if (!arg.empty()) { | 33 if (!arg.empty()) { |
37 if (arg == "enabled") | 34 if (arg == "enabled") |
38 enable_download_notification = true; | 35 enable_download_notification = true; |
39 else if (arg == "disabled") | 36 else if (arg == "disabled") |
40 enable_download_notification = false; | 37 enable_download_notification = false; |
41 } | 38 } |
42 return enable_download_notification; | 39 return enable_download_notification; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 DownloadItemNotification* item = new DownloadItemNotification(download, this); | 153 DownloadItemNotification* item = new DownloadItemNotification(download, this); |
157 items_.insert(std::make_pair(download, item)); | 154 items_.insert(std::make_pair(download, item)); |
158 | 155 |
159 group_notification_->OnDownloadAdded(download); | 156 group_notification_->OnDownloadAdded(download); |
160 } | 157 } |
161 | 158 |
162 DownloadGroupNotification* | 159 DownloadGroupNotification* |
163 DownloadNotificationManagerForProfile::GetGroupNotification() const { | 160 DownloadNotificationManagerForProfile::GetGroupNotification() const { |
164 return group_notification_.get(); | 161 return group_notification_.get(); |
165 } | 162 } |
OLD | NEW |