File: mac_util.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; 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,806; 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 (72 lines) | stat: -rw-r--r-- 2,776 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2020 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_UPDATER_UTIL_MAC_UTIL_H_
#define CHROME_UPDATER_UTIL_MAC_UTIL_H_

#include <optional>
#include <string>
#include <vector>

#include "chrome/updater/updater_scope.h"

namespace base {
class FilePath;
}  // namespace base

namespace updater {

// For user installations returns: the "~/Library" for the logged in user.
// For system installations returns: "/Library".
std::optional<base::FilePath> GetLibraryFolderPath(UpdaterScope scope);

// For user installations returns "~/Library/Application Support" for the
// logged in user. For system installations returns
// "/Library/Application Support".
std::optional<base::FilePath> GetApplicationSupportDirectory(
    UpdaterScope scope);

// Returns the user Application Support directories associated with the given
// scope. These directories are located under
// /Users/<user>/Library/Application\ Support. Returns a vector of all users'
// directories for all users in the system case, or the logged in user's
// otherwise.
std::vector<base::FilePath> GetApplicationSupportDirectoriesForUsers(
    UpdaterScope scope);

// Returns the path to Keystone's root directory.
std::optional<base::FilePath> GetKeystoneFolderPath(UpdaterScope scope);

// Returns the path to ksadmin, if it is present on the system. Ksadmin may be
// the shim installed by this updater or a Keystone ksadmin.
std::optional<base::FilePath> GetKSAdminPath(UpdaterScope scope);

// Returns the path to the wake task plist.
std::optional<base::FilePath> GetWakeTaskPlistPath(UpdaterScope scope);

std::string GetWakeLaunchdName(UpdaterScope scope);

// Removes the wake launch job.
bool RemoveWakeJobFromLaunchd(UpdaterScope scope);

// Prepare the macOS bundle at the specified path to subsequently run without
// propmpting the user (currently, this refers to Gatekeeper prompts). If some
// steps fail, this continues to run the rest anyway, preparing the bundle to
// run as best as it can. Returns whether every applicable prep step succeeded.
bool PrepareToRunBundle(const base::FilePath& bundle_path);

// Recursively remove quarantine attributes on `path`. Returns false on error.
bool RemoveQuarantineAttributes(const base::FilePath& path);

std::string GetDomain(UpdaterScope scope);

// Reads the value associated with `key` from the plist at `path`. Returns
// nullopt if `path` or `key` are empty, if the plist does not contain `key`, or
// if there are any errors.
std::optional<std::string> ReadValueFromPlist(const base::FilePath& path,
                                              const std::string& key);

}  // namespace updater

#endif  // CHROME_UPDATER_UTIL_MAC_UTIL_H_