chromium/chrome/browser/download/bubble/download_display_controller.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/download/bubble/download_display_controller.h"

#include "base/functional/bind.h"
#include "base/numerics/safe_conversions.h"
#include "base/power_monitor/power_monitor.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/download/bubble/download_bubble_display_info.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/download/bubble/download_bubble_ui_controller.h"
#include "chrome/browser/download/bubble/download_bubble_utils.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_prefs.h"
#include "chrome/browser/download/download_ui_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/download/download_item_mode.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/offline_items_collection/core/offline_item.h"
#include "components/offline_items_collection/core/offline_item_state.h"

#if BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/fullscreen_util_mac.h"
#endif

namespace {

DownloadIconActive;
DownloadIconState;
DownloadUIModelPtr;

// The amount of time for the toolbar icon to be visible after a download is
// completed.
constexpr base::TimeDelta kToolbarIconVisibilityTimeInterval =;

// The amount of time for the toolbar icon to stay active after a download is
// completed. If the download completed while full screen, the timer is started
// after user comes out of the full screen.
constexpr base::TimeDelta kToolbarIconActiveTimeInterval =;

// Whether there are no more in-progress downloads that are not paused, i.e.,
// whether all actively downloading items are done.
bool IsAllDone(const DownloadBubbleDisplayInfo& info) {}

// Whether the last download complete time is more recent than `interval` ago.
bool HasRecentCompleteDownload(base::TimeDelta interval,
                               base::Time last_complete_time) {}

// `profile` must be non-null. `app_id` can be null, signifying no app. This
// returns the most recent browser for the profile which matches the given app
// or lack thereof.
Browser* FindMostRecentBrowserForProfileMatchingWebApp(
    Profile* profile,
    const webapps::AppId* app_id) {}

}  // namespace

DownloadDisplayController::DownloadDisplayController(
    DownloadDisplay* display,
    Browser* browser,
    DownloadBubbleUIController* bubble_controller)
    :{}

DownloadDisplayController::~DownloadDisplayController() {}

void DownloadDisplayController::OnNewItem(bool show_animation) {}

void DownloadDisplayController::OnUpdatedItem(bool is_done,
                                              bool may_show_details) {}

void DownloadDisplayController::OnRemovedItem(const ContentId& id) {}

void DownloadDisplayController::OnButtonPressed() {}

void DownloadDisplayController::HandleButtonPressed() {}

void DownloadDisplayController::ShowToolbarButton() {}

void DownloadDisplayController::HideToolbarButton() {}

void DownloadDisplayController::HideBubble() {}

bool DownloadDisplayController::OpenMostSpecificDialog(
    const offline_items_collection::ContentId& content_id) {}

void DownloadDisplayController::ListenToFullScreenChanges() {}

void DownloadDisplayController::OnFullscreenStateChanged() {}

void DownloadDisplayController::OnResume() {}

void DownloadDisplayController::OpenSecuritySubpage(
    const offline_items_collection::ContentId& id) {}

void DownloadDisplayController::UpdateToolbarButtonState(
    const DownloadBubbleDisplayInfo& info,
    const DownloadDisplay::ProgressInfo& progress_info) {}

void DownloadDisplayController::UpdateDownloadIconToInactive() {}

const DownloadBubbleDisplayInfo&
DownloadDisplayController::UpdateButtonStateFromUpdateService() {}

void DownloadDisplayController::HandleAccessibleAlerts() {}

void DownloadDisplayController::ScheduleToolbarDisappearance(
    base::TimeDelta interval) {}

void DownloadDisplayController::ScheduleToolbarInactive(
    base::TimeDelta interval) {}

void DownloadDisplayController::MaybeShowButtonWhenCreated() {}