aw_download_manager_delegate.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (c) 2012 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. #ifndef ANDROID_WEBVIEW_BROWSER_AW_DOWNLOAD_MANAGER_DELEGATE_H_
  5. #define ANDROID_WEBVIEW_BROWSER_AW_DOWNLOAD_MANAGER_DELEGATE_H_
  6. #include <string>
  7. #include "base/supports_user_data.h"
  8. #include "content/public/browser/download_manager_delegate.h"
  9. namespace content {
  10. class WebContents;
  11. } // namespace content
  12. namespace android_webview {
  13. // Android WebView does not use Chromium downloads, so implement methods here to
  14. // unconditionally cancel the download.
  15. class AwDownloadManagerDelegate : public content::DownloadManagerDelegate,
  16. public base::SupportsUserData::Data {
  17. public:
  18. AwDownloadManagerDelegate();
  19. AwDownloadManagerDelegate(const AwDownloadManagerDelegate&) = delete;
  20. AwDownloadManagerDelegate& operator=(const AwDownloadManagerDelegate&) =
  21. delete;
  22. ~AwDownloadManagerDelegate() override;
  23. // content::DownloadManagerDelegate implementation.
  24. bool InterceptDownloadIfApplicable(
  25. const GURL& url,
  26. const std::string& user_agent,
  27. const std::string& content_disposition,
  28. const std::string& mime_type,
  29. const std::string& request_origin,
  30. int64_t content_length,
  31. bool is_transient,
  32. content::WebContents* web_contents) override;
  33. };
  34. } // namespace android_webview
  35. #endif // ANDROID_WEBVIEW_BROWSER_AW_DOWNLOAD_MANAGER_DELEGATE_H_