OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/history/core/browser/download_constants.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace history { |
| 10 |
| 11 const DownloadState kStateInvalid = -1; |
| 12 const DownloadState kStateInProgress = 0; |
| 13 const DownloadState kStateComplete = 1; |
| 14 const DownloadState kStateCancelled = 2; |
| 15 const DownloadState kStateBug140687 = 3; |
| 16 const DownloadState kStateInterrupted = 4; |
| 17 |
| 18 DownloadState IntToDownloadState(int state) { |
| 19 switch (state) { |
| 20 case kStateInProgress: |
| 21 case kStateComplete: |
| 22 case kStateCancelled: |
| 23 case kStateInterrupted: |
| 24 return static_cast<DownloadState>(state); |
| 25 default: |
| 26 NOTREACHED(); |
| 27 return kStateInvalid; |
| 28 } |
| 29 } |
| 30 |
| 31 const DownloadDangerType kDangerTypeInvalid = -1; |
| 32 const DownloadDangerType kDangerTypeNotDangerous = 0; |
| 33 const DownloadDangerType kDangerTypeDangerousFile = 1; |
| 34 const DownloadDangerType kDangerTypeDangerousUrl = 2; |
| 35 const DownloadDangerType kDangerTypeDangerousContent = 3; |
| 36 const DownloadDangerType kDangerTypeMaybeDangerousContent = 4; |
| 37 const DownloadDangerType kDangerTypeUncommonContent = 5; |
| 38 const DownloadDangerType kDangerTypeUserValidated = 6; |
| 39 const DownloadDangerType kDangerTypeDangerousHost = 7; |
| 40 const DownloadDangerType kDangerTypePotentiallyUnwanted = 8; |
| 41 |
| 42 DownloadDangerType IntToDownloadDangerType(int state) { |
| 43 switch (state) { |
| 44 case kDangerTypeNotDangerous: |
| 45 case kDangerTypeDangerousFile: |
| 46 case kDangerTypeDangerousUrl: |
| 47 case kDangerTypeDangerousContent: |
| 48 case kDangerTypeMaybeDangerousContent: |
| 49 case kDangerTypeUncommonContent: |
| 50 case kDangerTypeUserValidated: |
| 51 case kDangerTypeDangerousHost: |
| 52 case kDangerTypePotentiallyUnwanted: |
| 53 return static_cast<DownloadState>(state); |
| 54 default: |
| 55 NOTREACHED(); |
| 56 return kDangerTypeInvalid; |
| 57 } |
| 58 } |
| 59 |
| 60 const DownloadId kInvalidDownloadId = 0; |
| 61 |
| 62 } // namespace history |
OLD | NEW |