summaryrefslogtreecommitdiff
path: root/chromium/components/download/database/download_namespace.cc
blob: ac9554a43d2e876b42b05a754985ba2a20b99d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2018 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/download/database/download_namespace.h"

namespace download {

namespace {
const char kBrowserDownloadNamespace[] = "download";
const char kUnknownNamespace[] = "unknown";
}  // namespace

std::string DownloadNamespaceToString(DownloadNamespace download_namespace) {
  switch (download_namespace) {
    case DownloadNamespace::NAMESPACE_BROWSER_DOWNLOAD:
      return kBrowserDownloadNamespace;
    default:
      return kUnknownNamespace;
  }
}

DownloadNamespace DownloadNamespaceFromString(
    const std::string& namespace_string) {
  if (namespace_string == kBrowserDownloadNamespace)
    return DownloadNamespace::NAMESPACE_BROWSER_DOWNLOAD;
  return DownloadNamespace::NAMESPACE_UNKNOWN;
}

}  // namespace download