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_item_notification.h" | 11 #include "chrome/browser/download/notification/download_item_notification.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/grit/chromium_strings.h" | 13 #include "chrome/grit/chromium_strings.h" |
14 #include "content/public/browser/download_item.h" | 14 #include "content/public/browser/download_item.h" |
15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/message_center/message_center.h" | 18 #include "ui/message_center/message_center.h" |
19 #include "ui/message_center/notification.h" | 19 #include "ui/message_center/notification.h" |
20 #include "ui/message_center/notification_delegate.h" | 20 #include "ui/message_center/notification_delegate.h" |
21 | 21 |
22 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
23 // DownloadNotificationManager implementation: | 23 // DownloadNotificationManager implementation: |
24 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
25 | 25 |
26 bool DownloadNotificationManager::IsEnabled() { | 26 bool DownloadNotificationManager::IsEnabled() { |
27 #if defined(OS_CHROMEOS) | |
28 bool enable_download_notification = true; | 27 bool enable_download_notification = true; |
29 #else | |
30 bool enable_download_notification = false; | |
31 #endif | |
32 | |
33 std::string arg = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 28 std::string arg = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
34 switches::kEnableDownloadNotification); | 29 switches::kEnableDownloadNotification); |
35 if (!arg.empty()) { | 30 if (!arg.empty()) { |
36 if (arg == "enabled") | 31 if (arg == "enabled") |
37 enable_download_notification = true; | 32 enable_download_notification = true; |
38 else if (arg == "disabled") | 33 else if (arg == "disabled") |
39 enable_download_notification = false; | 34 enable_download_notification = false; |
40 } | 35 } |
41 return enable_download_notification; | 36 return enable_download_notification; |
42 } | 37 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 DCHECK_EQ(profile_, | 141 DCHECK_EQ(profile_, |
147 Profile::FromBrowserContext(download->GetBrowserContext())); | 142 Profile::FromBrowserContext(download->GetBrowserContext())); |
148 | 143 |
149 download->AddObserver(this); | 144 download->AddObserver(this); |
150 | 145 |
151 // |item| object will be inserted to |items_| by |OnCreated()| called in the | 146 // |item| object will be inserted to |items_| by |OnCreated()| called in the |
152 // constructor. | 147 // constructor. |
153 DownloadItemNotification* item = new DownloadItemNotification(download, this); | 148 DownloadItemNotification* item = new DownloadItemNotification(download, this); |
154 items_.insert(std::make_pair(download, item)); | 149 items_.insert(std::make_pair(download, item)); |
155 } | 150 } |
OLD | NEW |