OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // 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_INSTALLER_UTIL_PACKAGE_H_ | |
6 #define CHROME_INSTALLER_UTIL_PACKAGE_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "base/file_path.h" | |
12 #include "base/ref_counted.h" | |
13 | |
14 class CommandLine; | |
15 class Version; | |
16 | |
17 namespace installer { | |
18 | |
19 enum InstallStatus; | |
20 class Product; | |
21 class PackageProperties; | |
22 | |
23 typedef std::vector<scoped_refptr<const Product> > Products; | |
24 | |
25 // Represents a physical installation. An instance of this class is associated | |
26 // with one or more Product instances. Product objects can share a Package but | |
27 // not vice versa. | |
28 class Package : public base::RefCounted<Package> { | |
29 public: | |
30 Package(bool multi_install, bool system_level, const FilePath& path, | |
31 PackageProperties* properties); | |
32 | |
33 // Returns the path of the installation folder. | |
34 const FilePath& path() const; | |
35 | |
36 const Products& products() const; | |
37 | |
38 PackageProperties* properties() const; | |
39 | |
40 bool multi_install() const; | |
41 | |
42 bool system_level() const; | |
43 | |
44 bool IsEqual(const FilePath& path) const; | |
45 | |
46 void AssociateProduct(const Product* product); | |
47 | |
48 // Get path to the installer under Chrome version folder | |
49 // (for example <path>\Google\Chrome\Application\<Version>\Installer) | |
50 FilePath GetInstallerDirectory(const Version& version) const; | |
51 | |
52 // Figure out the oldest currently installed version for this package | |
53 // Returns NULL if none is found. Caller is responsible for freeing | |
54 // the returned Version object if valid. | |
55 // The function DCHECKs if it finds that not all products in this | |
56 // folder have the same current version. | |
57 Version* GetCurrentVersion() const; | |
58 | |
59 // Tries to remove all previous version directories (after a new Chrome | |
60 // update). If an instance of Chrome with older version is still running | |
61 // on the system, its corresponding version directory will be left intact. | |
62 // (The version directory is subject for removal again during next update.) | |
63 // | |
64 // latest_version: the latest version of Chrome installed. | |
65 void RemoveOldVersionDirectories(const Version& latest_version) const; | |
66 | |
67 // Returns how many installed products depend on the binaries currently | |
68 // in the installation path. | |
69 // Note: The function counts only products that are installed as part of | |
70 // a multi install installation and only products that have the same | |
71 // system_level() value. | |
72 size_t GetMultiInstallDependencyCount() const; | |
73 | |
74 protected: | |
75 bool multi_install_; | |
76 bool system_level_; | |
77 FilePath path_; | |
78 Products products_; | |
79 PackageProperties* properties_; // Weak reference. | |
80 | |
81 private: | |
82 friend class base::RefCounted<Package>; | |
83 ~Package(); | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(Package); | |
86 }; | |
87 | |
88 } // namespace installer | |
89 | |
90 #endif // CHROME_INSTALLER_UTIL_PACKAGE_H_ | |
OLD | NEW |