File: file_system_access_ui_helpers.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (41 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download | duplicates (6)
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
// Copyright 2019 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_UI_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_UI_HELPERS_H_
#define CHROME_BROWSER_UI_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_UI_HELPERS_H_

#include <memory>
#include <string>

class Profile;
class GURL;

namespace content {
struct PathInfo;
}

namespace file_system_access_ui_helper {

// Returns a human-readable string for use in titles of dialogs. Uses
// `path_info.display_name` if it is non-empty and does not match
// path_info.path.BaseName(), otherwise uses `path_info.path`. Shows the drive
// letter of a path if it is the root of a file system. Elides `path` to fit
// within a standard dialog, prioritizing the file extension. See
// https://crbug.com/1354505 for context.
std::u16string GetElidedPathForDisplayAsTitle(
    const content::PathInfo& path_info);
// Same as above, but does not elide `path`. This should only be used when it is
// safe to show a path which may overflow its container and have the path cut
// off (i.e. the site has already granted access to the file) or where extra
// characters would spill to the next line rather than be cut off (such as a
// dialog paragraph). See https://crbug.com/1354505 for context.
std::u16string GetPathForDisplayAsParagraph(const content::PathInfo& path);

// Returns the displayable URL identity. For most URLs, it'll be the formatted
// origin. For Isolated Web Apps and Extensions, it will be their name.
std::u16string GetUrlIdentityName(Profile* profile, const GURL& url);

}  // namespace file_system_access_ui_helper

#endif  // CHROME_BROWSER_UI_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_UI_HELPERS_H_