OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 PendingExtensionInfo(const std::string& id, | 30 PendingExtensionInfo(const std::string& id, |
31 const std::string& install_parameter, | 31 const std::string& install_parameter, |
32 const GURL& update_url, | 32 const GURL& update_url, |
33 const Version& version, | 33 const Version& version, |
34 ShouldAllowInstallPredicate should_allow_install, | 34 ShouldAllowInstallPredicate should_allow_install, |
35 bool is_from_sync, | 35 bool is_from_sync, |
36 bool install_silently, | 36 bool install_silently, |
37 Manifest::Location install_source, | 37 Manifest::Location install_source, |
38 int creation_flags, | 38 int creation_flags, |
39 bool mark_acknowledged); | 39 bool mark_acknowledged, |
| 40 bool remote_install); |
40 | 41 |
41 // Required for STL container membership. Should not be used directly. | 42 // Required for STL container membership. Should not be used directly. |
42 PendingExtensionInfo(); | 43 PendingExtensionInfo(); |
43 | 44 |
44 ~PendingExtensionInfo(); | 45 ~PendingExtensionInfo(); |
45 | 46 |
46 // Consider two PendingExtensionInfos equal if their ids are equal. | 47 // Consider two PendingExtensionInfos equal if their ids are equal. |
47 bool operator==(const PendingExtensionInfo& rhs) const; | 48 bool operator==(const PendingExtensionInfo& rhs) const; |
48 | 49 |
49 const std::string& id() const { return id_; } | 50 const std::string& id() const { return id_; } |
50 const GURL& update_url() const { return update_url_; } | 51 const GURL& update_url() const { return update_url_; } |
51 const Version& version() const { return version_; } | 52 const Version& version() const { return version_; } |
52 const std::string& install_parameter() const { return install_parameter_; } | 53 const std::string& install_parameter() const { return install_parameter_; } |
53 | 54 |
54 // ShouldAllowInstall() returns the result of running constructor argument | 55 // ShouldAllowInstall() returns the result of running constructor argument |
55 // |should_allow_install| on an extension. After an extension is unpacked, | 56 // |should_allow_install| on an extension. After an extension is unpacked, |
56 // this function is run. If it returns true, the extension is installed. | 57 // this function is run. If it returns true, the extension is installed. |
57 // If not, the extension is discarded. This allows creators of | 58 // If not, the extension is discarded. This allows creators of |
58 // PendingExtensionInfo objects to ensure that extensions meet some criteria | 59 // PendingExtensionInfo objects to ensure that extensions meet some criteria |
59 // that can only be tested once the extension is unpacked. | 60 // that can only be tested once the extension is unpacked. |
60 bool ShouldAllowInstall(const Extension* extension) const { | 61 bool ShouldAllowInstall(const Extension* extension) const { |
61 return should_allow_install_(extension); | 62 return should_allow_install_(extension); |
62 } | 63 } |
63 bool is_from_sync() const { return is_from_sync_; } | 64 bool is_from_sync() const { return is_from_sync_; } |
64 bool install_silently() const { return install_silently_; } | 65 bool install_silently() const { return install_silently_; } |
65 Manifest::Location install_source() const { return install_source_; } | 66 Manifest::Location install_source() const { return install_source_; } |
66 int creation_flags() const { return creation_flags_; } | 67 int creation_flags() const { return creation_flags_; } |
67 bool mark_acknowledged() const { return mark_acknowledged_; } | 68 bool mark_acknowledged() const { return mark_acknowledged_; } |
| 69 bool remote_install() const { return remote_install_; } |
68 | 70 |
69 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than | 71 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than |
70 // |other|, respectively. "Equal" precedence means that the version and the | 72 // |other|, respectively. "Equal" precedence means that the version and the |
71 // install source match. "Higher" precedence means that the version is newer, | 73 // install source match. "Higher" precedence means that the version is newer, |
72 // or the version matches but the install source has higher priority. | 74 // or the version matches but the install source has higher priority. |
73 // It is only valid to invoke this when the ids match. | 75 // It is only valid to invoke this when the ids match. |
74 int CompareTo(const PendingExtensionInfo& other) const; | 76 int CompareTo(const PendingExtensionInfo& other) const; |
75 | 77 |
76 private: | 78 private: |
77 std::string id_; | 79 std::string id_; |
78 | 80 |
79 GURL update_url_; | 81 GURL update_url_; |
80 Version version_; | 82 Version version_; |
81 std::string install_parameter_; | 83 std::string install_parameter_; |
82 | 84 |
83 // When the extension is about to be installed, this function is | 85 // When the extension is about to be installed, this function is |
84 // called. If this function returns true, the install proceeds. If | 86 // called. If this function returns true, the install proceeds. If |
85 // this function returns false, the install is aborted. | 87 // this function returns false, the install is aborted. |
86 ShouldAllowInstallPredicate should_allow_install_; | 88 ShouldAllowInstallPredicate should_allow_install_; |
87 | 89 |
88 bool is_from_sync_; // This update check was initiated from sync. | 90 bool is_from_sync_; // This update check was initiated from sync. |
89 bool install_silently_; | 91 bool install_silently_; |
90 Manifest::Location install_source_; | 92 Manifest::Location install_source_; |
91 int creation_flags_; | 93 int creation_flags_; |
92 bool mark_acknowledged_; | 94 bool mark_acknowledged_; |
| 95 bool remote_install_; |
93 | 96 |
94 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync); | 97 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync); |
95 }; | 98 }; |
96 | 99 |
97 } // namespace extensions | 100 } // namespace extensions |
98 | 101 |
99 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ | 102 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ |
OLD | NEW |