blob: 3feba580aae7bf61d7303f0a3f200b8075c73a8f [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"
12#include "chrome/browser/download/download_target_determiner_delegate.h"
13#include "components/download/public/common/download_item.h"
14#include "url/gurl.h"
15
16// Helper class for download dialogs.
17class DownloadDialogUtils {
18 public:
19 // Helper method to find a download from a list of downloads based on its
20 // GUID, and remove it from the list.
21 static download::DownloadItem* FindAndRemoveDownload(
22 std::vector<download::DownloadItem*>* downloads,
23 const std::string& download_guid);
24
25 // Called when a new file was created and inform |callback| about
26 // the result and the new path.
27 static void CreateNewFileDone(
28 DownloadTargetDeterminerDelegate::ConfirmationCallback callback,
29 download::PathValidationResult result,
30 const base::FilePath& target_path);
31
32 // Called to get an elided URL for a page URL, so that it can be displayed
33 // on duplicate inforbar or dialog.
34 static std::string GetDisplayURLForPageURL(const GURL& page_url);
35};
36
37#endif // CHROME_BROWSER_DOWNLOAD_ANDROID_DOWNLOAD_DIALOG_UTILS_H_