blob: 097d47999b9ea93df5c35e94973b1c9d6948a0c5 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2021 The Chromium Authors
Min Qin42484d72021-08-27 14:52:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_DOWNLOAD_ANDROID_DOWNLOAD_DIALOG_UTILS_H_
6#define CHROME_BROWSER_DOWNLOAD_ANDROID_DOWNLOAD_DIALOG_UTILS_H_
7
8#include <string>
9#include <vector>
10
11#include "base/files/file_path.h"
Ali Hijazie63cbaf62023-12-20 19:29:3512#include "base/memory/raw_ptr.h"
Min Qin42484d72021-08-27 14:52:0513#include "chrome/browser/download/download_target_determiner_delegate.h"
14#include "components/download/public/common/download_item.h"
15#include "url/gurl.h"
16
17// Helper class for download dialogs.
18class DownloadDialogUtils {
19 public:
20 // Helper method to find a download from a list of downloads based on its
21 // GUID, and remove it from the list.
22 static download::DownloadItem* FindAndRemoveDownload(
Ali Hijazie63cbaf62023-12-20 19:29:3523 std::vector<raw_ptr<download::DownloadItem, VectorExperimental>>*
24 downloads,
Min Qin42484d72021-08-27 14:52:0525 const std::string& download_guid);
26
27 // Called when a new file was created and inform |callback| about
28 // the result and the new path.
29 static void CreateNewFileDone(
30 DownloadTargetDeterminerDelegate::ConfirmationCallback callback,
31 download::PathValidationResult result,
32 const base::FilePath& target_path);
33
34 // Called to get an elided URL for a page URL, so that it can be displayed
35 // on duplicate inforbar or dialog.
36 static std::string GetDisplayURLForPageURL(const GURL& page_url);
37};
38
39#endif // CHROME_BROWSER_DOWNLOAD_ANDROID_DOWNLOAD_DIALOG_UTILS_H_