| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download_status_updater.h" | 5 #include "chrome/browser/download/download_status_updater.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/win/metro.h" | 14 #include "base/win/metro.h" |
| 15 #include "base/win/scoped_comptr.h" | 15 #include "base/win/scoped_comptr.h" |
| 16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
| 17 #include "chrome/browser/platform_util.h" | 17 #include "chrome/browser/platform_util.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "win8/util/win8_util.h" |
| 26 | 27 |
| 27 // This code doesn't compile with Aura on. TODO(avi): hook it up so that | 28 // This code doesn't compile with Aura on. TODO(avi): hook it up so that |
| 28 // win_aura can do platform integration. | 29 // win_aura can do platform integration. |
| 29 #if !defined(USE_AURA) | 30 #if !defined(USE_AURA) |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 const char kDownloadNotificationPrefix[] = "DownloadNotification"; | 34 const char kDownloadNotificationPrefix[] = "DownloadNotification"; |
| 34 int g_next_notification_id = 0; | 35 int g_next_notification_id = 0; |
| 35 | 36 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void DownloadStatusUpdater::UpdateAppIconDownloadProgress( | 88 void DownloadStatusUpdater::UpdateAppIconDownloadProgress( |
| 88 content::DownloadItem* download) { | 89 content::DownloadItem* download) { |
| 89 | 90 |
| 90 // Always update overall progress. | 91 // Always update overall progress. |
| 91 float progress = 0; | 92 float progress = 0; |
| 92 int download_count = 0; | 93 int download_count = 0; |
| 93 bool progress_known = GetProgress(&progress, &download_count); | 94 bool progress_known = GetProgress(&progress, &download_count); |
| 94 UpdateTaskbarProgressBar(download_count, progress_known, progress); | 95 UpdateTaskbarProgressBar(download_count, progress_known, progress); |
| 95 | 96 |
| 96 // Fire notifications when downloads complete. | 97 // Fire notifications when downloads complete. |
| 97 if (!base::win::IsMetroProcess()) | 98 if (!win8::IsSingleWindowMetroMode()) |
| 98 return; | 99 return; |
| 99 | 100 |
| 100 if (download->GetState() != content::DownloadItem::COMPLETE) | 101 if (download->GetState() != content::DownloadItem::COMPLETE) |
| 101 return; | 102 return; |
| 102 | 103 |
| 103 if (download->GetOpenWhenComplete() || | 104 if (download->GetOpenWhenComplete() || |
| 104 download->ShouldOpenFileBasedOnExtension() || | 105 download->ShouldOpenFileBasedOnExtension() || |
| 105 download->IsTemporary() || | 106 download->IsTemporary() || |
| 106 download->GetAutoOpened()) | 107 download->GetAutoOpened()) |
| 107 return; | 108 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 title.c_str(), | 145 title.c_str(), |
| 145 body.c_str(), | 146 body.c_str(), |
| 146 L"", | 147 L"", |
| 147 notification_id.c_str(), | 148 notification_id.c_str(), |
| 148 MetroDownloadNotificationClickedHandler, | 149 MetroDownloadNotificationClickedHandler, |
| 149 download->GetTargetFilePath().value().c_str()); | 150 download->GetTargetFilePath().value().c_str()); |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 | 153 |
| 153 #endif // !USE_AURA | 154 #endif // !USE_AURA |
| OLD | NEW |