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);
|
|
|
|
~CefDownloadManagerDelegate();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// DownloadItem::Observer methods.
|
|
|
|
virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
|
|
|
|
virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
|
|
|
|
|
|
|
|
// DownloadManager::Observer methods.
|
|
|
|
virtual void OnDownloadCreated(content::DownloadManager* manager,
|
|
|
|
content::DownloadItem* item) OVERRIDE;
|
|
|
|
virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// DownloadManagerDelegate methods.
|
2012-08-04 02:59:58 +02:00
|
|
|
virtual bool DetermineDownloadTarget(
|
|
|
|
content::DownloadItem* item,
|
|
|
|
const content::DownloadTargetCallback& callback) OVERRIDE;
|
2013-07-24 22:15:18 +02:00
|
|
|
virtual 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_
|