summaryrefslogtreecommitdiff
path: root/chromium/components/offline_pages/core/stub_system_download_manager.cc
blob: 2b8562fe550d220864e5d2a8a087447db840e7cd (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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/offline_pages/core/stub_system_download_manager.h"

namespace offline_pages {

StubSystemDownloadManager::StubSystemDownloadManager(int64_t id_to_use,
                                                     bool installed)
    : download_id_(id_to_use), last_removed_id_(0), installed_(installed) {}

StubSystemDownloadManager::~StubSystemDownloadManager() {}

bool StubSystemDownloadManager::IsDownloadManagerInstalled() {
  return installed_;
}

int64_t StubSystemDownloadManager::AddCompletedDownload(
    const std::string& title,
    const std::string& description,
    const std::string& path,
    int64_t length,
    const std::string& uri,
    const std::string& referer) {
  title_ = title;
  description_ = description;
  path_ = path;
  length_ = length;
  uri_ = uri;
  referer_ = referer;

  return download_id_;
}

int StubSystemDownloadManager::Remove(
    const std::vector<int64_t>& android_download_manager_ids) {
  int count = static_cast<int>(android_download_manager_ids.size());
  if (count > 0)
    last_removed_id_ = android_download_manager_ids[count - 1];
  return count;
}

}  // namespace offline_pages