Chromium Code Reviews| 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/history/download_database.h" | 5 #include "chrome/browser/history/download_database.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 const int DownloadDatabase::kDangerTypeUserValidated = 6; | 88 const int DownloadDatabase::kDangerTypeUserValidated = 6; |
| 89 const int DownloadDatabase::kDangerTypeDangerousHost = 7; | 89 const int DownloadDatabase::kDangerTypeDangerousHost = 7; |
| 90 const int DownloadDatabase::kDangerTypePotentiallyUnwanted = 8; | 90 const int DownloadDatabase::kDangerTypePotentiallyUnwanted = 8; |
| 91 | 91 |
| 92 int DownloadDatabase::StateToInt(DownloadItem::DownloadState state) { | 92 int DownloadDatabase::StateToInt(DownloadItem::DownloadState state) { |
| 93 switch (state) { | 93 switch (state) { |
| 94 case DownloadItem::IN_PROGRESS: return DownloadDatabase::kStateInProgress; | 94 case DownloadItem::IN_PROGRESS: return DownloadDatabase::kStateInProgress; |
| 95 case DownloadItem::COMPLETE: return DownloadDatabase::kStateComplete; | 95 case DownloadItem::COMPLETE: return DownloadDatabase::kStateComplete; |
| 96 case DownloadItem::CANCELLED: return DownloadDatabase::kStateCancelled; | 96 case DownloadItem::CANCELLED: return DownloadDatabase::kStateCancelled; |
| 97 case DownloadItem::INTERRUPTED: return DownloadDatabase::kStateInterrupted; | 97 case DownloadItem::INTERRUPTED: return DownloadDatabase::kStateInterrupted; |
| 98 case DownloadItem::REMOVED: | |
|
Dan Beam
2014/11/13 02:51:16
i'll change this if we decide to sync this status
| |
| 98 case DownloadItem::MAX_DOWNLOAD_STATE: | 99 case DownloadItem::MAX_DOWNLOAD_STATE: |
| 99 NOTREACHED(); | 100 NOTREACHED(); |
| 100 return DownloadDatabase::kStateInvalid; | 101 return DownloadDatabase::kStateInvalid; |
| 101 } | 102 } |
| 102 NOTREACHED(); | 103 NOTREACHED(); |
| 103 return DownloadDatabase::kStateInvalid; | 104 return DownloadDatabase::kStateInvalid; |
| 104 } | 105 } |
| 105 | 106 |
| 106 DownloadItem::DownloadState DownloadDatabase::IntToState(int state) { | 107 DownloadItem::DownloadState DownloadDatabase::IntToState(int state) { |
| 107 switch (state) { | 108 switch (state) { |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 size_t DownloadDatabase::CountDownloads() { | 663 size_t DownloadDatabase::CountDownloads() { |
| 663 EnsureInProgressEntriesCleanedUp(); | 664 EnsureInProgressEntriesCleanedUp(); |
| 664 | 665 |
| 665 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, | 666 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
| 666 "SELECT count(*) from downloads")); | 667 "SELECT count(*) from downloads")); |
| 667 statement.Step(); | 668 statement.Step(); |
| 668 return statement.ColumnInt(0); | 669 return statement.ColumnInt(0); |
| 669 } | 670 } |
| 670 | 671 |
| 671 } // namespace history | 672 } // namespace history |
| OLD | NEW |