blob: c7318e15baebff5e8aed00c91713f106bbd321a5 (
plain)
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
73
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_INSTALLER_UTIL_PACKAGE_H_
#define CHROME_INSTALLER_UTIL_PACKAGE_H_
#pragma once
#include <vector>
#include "base/file_path.h"
#include "base/ref_counted.h"
class CommandLine;
namespace installer {
class Product;
class Version;
typedef std::vector<scoped_refptr<const Product> > Products;
// Represents a physical installation. An instance of this class is associated
// with one or more Product instances. Product objects can share a Package but
// not vice versa.
class Package : public base::RefCounted<Package> {
public:
explicit Package(const FilePath& path);
// Returns the path of the installation folder.
const FilePath& path() const;
const Products& products() const;
bool system_level() const;
bool IsEqual(const FilePath& path) const;
void AssociateProduct(const Product* distribution);
// Get path to the installer under Chrome version folder
// (for example <path>\Google\Chrome\<Version>\installer)
FilePath GetInstallerDirectory(const Version& version) const;
// Figure out the oldest currently installed version for this package
// Returns NULL if none is found. Caller is responsible for freeing
// the returned Version object if valid.
// The function DCHECKs if it finds that not all products in this
// folder have the same current version.
Version* GetCurrentVersion() const;
// Tries to remove all previous version directories (after a new Chrome
// update). If an instance of Chrome with older version is still running
// on the system, its corresponding version directory will be left intact.
// (The version directory is subject for removal again during next update.)
//
// latest_version: the latest version of Chrome installed.
void RemoveOldVersionDirectories(const Version& latest_version) const;
protected:
FilePath path_;
Products products_;
private:
friend class base::RefCounted<Package>;
~Package();
DISALLOW_COPY_AND_ASSIGN(Package);
};
} // namespace installer
#endif // CHROME_INSTALLER_UTIL_PACKAGE_H_
|