File: jumplist_file_util.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (45 lines) | stat: -rw-r--r-- 2,213 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_
#define CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_

#include "base/containers/flat_set.h"
#include "base/files/file_path.h"

// Maximum number of icon files allowed to delete per jumplist update.
inline constexpr int kFileDeleteLimit = 30;

// This method is similar to base::DeleteFileRecursive in
// file_util_win.cc with the following differences.
// 1) It has an input parameter |max_file_deleted| to specify the maximum files
//    allowed to delete as well as the maximum attempt failures allowd per run.
// 2) It deletes only the files in |path|. All subdirectories in |path| are
//    untouched but are considered as attempt failures.
void DeleteFiles(const base::FilePath& path,
                 const base::FilePath::StringType& pattern,
                 int max_file_deleted);

// This method is similar to base::DeleteFile in file_util_win.cc
// with the following differences.
// 1) It has an input parameter |max_file_deleted| to specify the maximum files
//    allowed to delete as well as the maximum attempt failures allowd per run.
// 2) It deletes only the files in |path|. All subdirectories in |path| are
//    untouched but are considered as attempt failures.
// 3) |path| won't be removed even if all its contents are deleted successfully.
void DeleteDirectoryContent(const base::FilePath& path, int max_file_deleted);

// This method firstly calls DeleteDirectoryContent() to delete the contents in
// |path|. If |path| is empty after the call, it is removed.
void DeleteDirectory(const base::FilePath& path, int max_file_deleted);

// Returns true if the directory at |path| has more than |max_files| files.
// Sub-directories are not taken into account here.
bool FilesExceedLimitInDir(const base::FilePath& path, int max_files);

// Deletes all files in the directory at |path| but not in set |cached_files|.
void DeleteNonCachedFiles(const base::FilePath& path,
                          const base::flat_set<base::FilePath>& cached_files);

#endif  // CHROME_BROWSER_WIN_JUMPLIST_FILE_UTIL_H_