#include "chrome/browser/download/bubble/download_bubble_ui_controller.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_index/content_index_provider_impl.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/download/bubble/download_bubble_update_service.h"
#include "chrome/browser/download/bubble/download_bubble_update_service_factory.h"
#include "chrome/browser/download/bubble/download_bubble_utils.h"
#include "chrome/browser/download/bubble/download_display_controller.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_core_service.h"
#include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_item_warning_data.h"
#include "chrome/browser/download/download_item_web_app_data.h"
#include "chrome/browser/download/download_ui_model.h"
#include "chrome/browser/download/download_warning_desktop_hats_utils.h"
#include "chrome/browser/download/offline_item_model_manager.h"
#include "chrome/browser/download/offline_item_model_manager_factory.h"
#include "chrome/browser/download/offline_item_utils.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/hats/trust_safety_sentiment_service.h"
#include "chrome/browser/ui/hats/trust_safety_sentiment_service_factory.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_stats.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/offline_items_collection/core/offline_content_aggregator.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/browser/download_manager.h"
namespace {
DownloadCreationType;
DownloadUIModelPtr;
constexpr base::TimeDelta kShowPartialViewMinInterval = …;
bool IsForDownload(Browser* browser, download::DownloadItem* item) { … }
}
DownloadBubbleUIController* DownloadBubbleUIController::GetForDownload(
download::DownloadItem* item) { … }
DownloadBubbleUIController::DownloadBubbleUIController(Browser* browser)
: … { … }
DownloadBubbleUIController::DownloadBubbleUIController(
Browser* browser,
DownloadBubbleUpdateService* update_service)
: … { … }
DownloadBubbleUIController::~DownloadBubbleUIController() = default;
void DownloadBubbleUIController::HideDownloadUi() { … }
void DownloadBubbleUIController::HandleButtonPressed() { … }
bool DownloadBubbleUIController::OpenMostSpecificDialog(
const offline_items_collection::ContentId& content_id) { … }
void DownloadBubbleUIController::OnOfflineItemsAdded(
const OfflineContentProvider::OfflineItemList& items) { … }
void DownloadBubbleUIController::OnDownloadItemAdded(
download::DownloadItem* item,
bool may_show_animation) { … }
void DownloadBubbleUIController::OnOfflineItemRemoved(const ContentId& id) { … }
void DownloadBubbleUIController::OnDownloadItemRemoved(
download::DownloadItem* item) { … }
void DownloadBubbleUIController::OnOfflineItemUpdated(const OfflineItem& item) { … }
void DownloadBubbleUIController::OnDownloadItemUpdated(
download::DownloadItem* item) { … }
std::vector<DownloadUIModelPtr> DownloadBubbleUIController::GetDownloadUIModels(
bool is_main_view) { … }
std::vector<DownloadUIModelPtr> DownloadBubbleUIController::GetMainView() { … }
std::vector<DownloadUIModelPtr> DownloadBubbleUIController::GetPartialView() { … }
void DownloadBubbleUIController::ProcessDownloadButtonPress(
base::WeakPtr<DownloadUIModel> model,
DownloadCommands::Command command,
bool is_main_view) { … }
void DownloadBubbleUIController::RetryDownload(
DownloadUIModel* model,
DownloadCommands::Command command) { … }
void DownloadBubbleUIController::ScheduleCancelForEphemeralWarning(
const std::string& guid) { … }
void DownloadBubbleUIController::CompleteHatsPsd(
DownloadWarningHatsProductSpecificData& psd) { … }
void DownloadBubbleUIController::OnBrowserActivity() { … }
void DownloadBubbleUIController::RecordDangerousDownloadShownToUser(
download::DownloadItem* download) { … }
base::WeakPtr<DownloadBubbleUIController>
DownloadBubbleUIController::GetWeakPtr() { … }
void DownloadBubbleUIController::SetDeepScanNoticeSeen() { … }