| Index: components/history/core/browser/download_constants.cc
|
| diff --git a/components/history/core/browser/download_constants.cc b/components/history/core/browser/download_constants.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f89dac6a0e9ca536f09481ef0de1f14d493c5461
|
| --- /dev/null
|
| +++ b/components/history/core/browser/download_constants.cc
|
| @@ -0,0 +1,62 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/history/core/browser/download_constants.h"
|
| +
|
| +#include "base/logging.h"
|
| +
|
| +namespace history {
|
| +
|
| +const DownloadState kStateInvalid = -1;
|
| +const DownloadState kStateInProgress = 0;
|
| +const DownloadState kStateComplete = 1;
|
| +const DownloadState kStateCancelled = 2;
|
| +const DownloadState kStateBug140687 = 3;
|
| +const DownloadState kStateInterrupted = 4;
|
| +
|
| +DownloadState IntToDownloadState(int state) {
|
| + switch (state) {
|
| + case kStateInProgress:
|
| + case kStateComplete:
|
| + case kStateCancelled:
|
| + case kStateInterrupted:
|
| + return static_cast<DownloadState>(state);
|
| + default:
|
| + NOTREACHED();
|
| + return kStateInvalid;
|
| + }
|
| +}
|
| +
|
| +const DownloadDangerType kDangerTypeInvalid = -1;
|
| +const DownloadDangerType kDangerTypeNotDangerous = 0;
|
| +const DownloadDangerType kDangerTypeDangerousFile = 1;
|
| +const DownloadDangerType kDangerTypeDangerousUrl = 2;
|
| +const DownloadDangerType kDangerTypeDangerousContent = 3;
|
| +const DownloadDangerType kDangerTypeMaybeDangerousContent = 4;
|
| +const DownloadDangerType kDangerTypeUncommonContent = 5;
|
| +const DownloadDangerType kDangerTypeUserValidated = 6;
|
| +const DownloadDangerType kDangerTypeDangerousHost = 7;
|
| +const DownloadDangerType kDangerTypePotentiallyUnwanted = 8;
|
| +
|
| +DownloadDangerType IntToDownloadDangerType(int state) {
|
| + switch (state) {
|
| + case kDangerTypeNotDangerous:
|
| + case kDangerTypeDangerousFile:
|
| + case kDangerTypeDangerousUrl:
|
| + case kDangerTypeDangerousContent:
|
| + case kDangerTypeMaybeDangerousContent:
|
| + case kDangerTypeUncommonContent:
|
| + case kDangerTypeUserValidated:
|
| + case kDangerTypeDangerousHost:
|
| + case kDangerTypePotentiallyUnwanted:
|
| + return static_cast<DownloadState>(state);
|
| + default:
|
| + NOTREACHED();
|
| + return kDangerTypeInvalid;
|
| + }
|
| +}
|
| +
|
| +const DownloadId kInvalidDownloadId = 0;
|
| +
|
| +} // namespace history
|
|
|