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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 static bool Get(content::DownloadItem* item) { | 33 static bool Get(content::DownloadItem* item) { |
34 return item->GetUserData(kKey) != NULL; | 34 return item->GetUserData(kKey) != NULL; |
35 } | 35 } |
36 | 36 |
37 static void Clear(content::DownloadItem* item) { | 37 static void Clear(content::DownloadItem* item) { |
38 item->RemoveUserData(kKey); | 38 item->RemoveUserData(kKey); |
39 } | 39 } |
40 | 40 |
41 explicit WasInProgressData(content::DownloadItem* item) { | 41 explicit WasInProgressData(content::DownloadItem* item) { |
42 item->SetUserData(kKey, this); | 42 item->SetUserData(kKey, base::WrapUnique(this)); |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 static const char kKey[]; | 46 static const char kKey[]; |
47 DISALLOW_COPY_AND_ASSIGN(WasInProgressData); | 47 DISALLOW_COPY_AND_ASSIGN(WasInProgressData); |
48 }; | 48 }; |
49 | 49 |
50 const char WasInProgressData::kKey[] = | 50 const char WasInProgressData::kKey[] = |
51 "DownloadItem DownloadStatusUpdater WasInProgressData"; | 51 "DownloadItem DownloadStatusUpdater WasInProgressData"; |
52 | 52 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 float progress = 0; | 142 float progress = 0; |
143 int download_count = 0; | 143 int download_count = 0; |
144 GetProgress(&progress, &download_count); | 144 GetProgress(&progress, &download_count); |
145 linux_ui->SetDownloadCount(download_count); | 145 linux_ui->SetDownloadCount(download_count); |
146 linux_ui->SetProgressFraction(progress); | 146 linux_ui->SetProgressFraction(progress); |
147 } | 147 } |
148 #endif | 148 #endif |
149 // TODO(avi): Implement for Android? | 149 // TODO(avi): Implement for Android? |
150 } | 150 } |
151 #endif | 151 #endif |
OLD | NEW |