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 <objbase.h> | 7 #include <objbase.h> |
8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/win/scoped_comptr.h" | 12 #include "base/win/scoped_comptr.h" |
13 #include "base/win/windows_version.h" | |
14 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
17 #include "ui/views/win/hwnd_util.h" | 16 #include "ui/views/win/hwnd_util.h" |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 void UpdateTaskbarProgressBar(int download_count, | 20 void UpdateTaskbarProgressBar(int download_count, |
22 bool progress_known, | 21 bool progress_known, |
23 float progress) { | 22 float progress) { |
24 // Taskbar progress bar is only supported on Win7. | |
25 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
26 return; | |
27 | |
28 base::win::ScopedComPtr<ITaskbarList3> taskbar; | 23 base::win::ScopedComPtr<ITaskbarList3> taskbar; |
29 HRESULT result = ::CoCreateInstance( | 24 HRESULT result = ::CoCreateInstance( |
30 CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar)); | 25 CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar)); |
31 if (FAILED(result)) { | 26 if (FAILED(result)) { |
32 DVLOG(1) << "Failed creating a TaskbarList object: " << result; | 27 DVLOG(1) << "Failed creating a TaskbarList object: " << result; |
33 return; | 28 return; |
34 } | 29 } |
35 | 30 |
36 result = taskbar->HrInit(); | 31 result = taskbar->HrInit(); |
37 if (FAILED(result)) { | 32 if (FAILED(result)) { |
(...skipping 20 matching lines...) Expand all Loading... |
58 | 53 |
59 void DownloadStatusUpdater::UpdateAppIconDownloadProgress( | 54 void DownloadStatusUpdater::UpdateAppIconDownloadProgress( |
60 content::DownloadItem* download) { | 55 content::DownloadItem* download) { |
61 | 56 |
62 // Always update overall progress. | 57 // Always update overall progress. |
63 float progress = 0; | 58 float progress = 0; |
64 int download_count = 0; | 59 int download_count = 0; |
65 bool progress_known = GetProgress(&progress, &download_count); | 60 bool progress_known = GetProgress(&progress, &download_count); |
66 UpdateTaskbarProgressBar(download_count, progress_known, progress); | 61 UpdateTaskbarProgressBar(download_count, progress_known, progress); |
67 } | 62 } |
OLD | NEW |