2012-06-08 18:01:01 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
2012-04-03 03:34:16 +02:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
|
|
|
|
#pragma once
|
|
|
|
|
2012-11-30 20:08:20 +01:00
|
|
|
#include <set>
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "base/compiler_specific.h"
|
2012-11-30 20:08:20 +01:00
|
|
|
#include "base/memory/weak_ptr.h"
|
|
|
|
#include "content/public/browser/download_item.h"
|
|
|
|
#include "content/public/browser/download_manager.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "content/public/browser/download_manager_delegate.h"
|
|
|
|
|
|
|
|
class CefDownloadManagerDelegate
|
2012-11-30 20:08:20 +01:00
|
|
|
: public content::DownloadItem::Observer,
|
|
|
|
public content::DownloadManager::Observer,
|
|
|
|
public content::DownloadManagerDelegate {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2012-11-30 20:08:20 +01:00
|
|
|
explicit CefDownloadManagerDelegate(content::DownloadManager* manager);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefDownloadManagerDelegate() override;
|
2012-11-30 20:08:20 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// DownloadItem::Observer methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
void OnDownloadUpdated(content::DownloadItem* download) override;
|
|
|
|
void OnDownloadDestroyed(content::DownloadItem* download) override;
|
2012-11-30 20:08:20 +01:00
|
|
|
|
|
|
|
// DownloadManager::Observer methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
void OnDownloadCreated(content::DownloadManager* manager,
|
|
|
|
content::DownloadItem* item) override;
|
|
|
|
void ManagerGoingDown(content::DownloadManager* manager) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// DownloadManagerDelegate methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
bool DetermineDownloadTarget(
|
2012-08-04 02:59:58 +02:00
|
|
|
content::DownloadItem* item,
|
2014-11-12 20:25:15 +01:00
|
|
|
const content::DownloadTargetCallback& callback) override;
|
|
|
|
void GetNextId(const content::DownloadIdCallback& callback) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-11-30 20:08:20 +01:00
|
|
|
content::DownloadManager* manager_;
|
|
|
|
base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_;
|
|
|
|
std::set<content::DownloadItem*> observing_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
|