1 // Copyright 2017 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 #ifndef CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_OFFLINE_PREFETCH_DOWNLOAD_CLIENT_H_ 6 #define CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_OFFLINE_PREFETCH_DOWNLOAD_CLIENT_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "base/macros.h" 12 #include "components/download/public/background_service/client.h" 13 14 class SimpleFactoryKey; 15 16 namespace download { 17 struct CompletionInfo; 18 struct DownloadMetaData; 19 } // namespace download 20 21 namespace offline_pages { 22 23 class PrefetchDownloader; 24 25 class OfflinePrefetchDownloadClient : public download::Client { 26 public: 27 explicit OfflinePrefetchDownloadClient(SimpleFactoryKey* simple_factory_key); 28 ~OfflinePrefetchDownloadClient() override; 29 30 private: 31 // Overridden from Client: 32 void OnServiceInitialized( 33 bool state_lost, 34 const std::vector<download::DownloadMetaData>& downloads) override; 35 void OnServiceUnavailable() override; 36 void OnDownloadFailed(const std::string& guid, 37 const download::CompletionInfo& completion_info, 38 download::Client::FailureReason reason) override; 39 void OnDownloadSucceeded( 40 const std::string& guid, 41 const download::CompletionInfo& completion_info) override; 42 bool CanServiceRemoveDownloadedFile(const std::string& guid, 43 bool force_delete) override; 44 void GetUploadData(const std::string& guid, 45 download::GetUploadDataCallback callback) override; 46 47 PrefetchDownloader* GetPrefetchDownloader() const; 48 49 SimpleFactoryKey* simple_factory_key_; 50 51 DISALLOW_COPY_AND_ASSIGN(OfflinePrefetchDownloadClient); 52 }; 53 54 } // namespace offline_pages 55 56 #endif // CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_OFFLINE_PREFETCH_DOWNLOAD_CLIENT_H_ 57