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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/time/time.h" | |
13 #include "chrome/browser/extensions/pending_extension_info.h" | 15 #include "chrome/browser/extensions/pending_extension_info.h" |
14 #include "extensions/common/manifest.h" | 16 #include "extensions/common/manifest.h" |
15 | 17 |
16 class GURL; | 18 class GURL; |
17 | 19 |
18 namespace base { | 20 namespace base { |
19 class Version; | 21 class Version; |
20 } | 22 } |
21 | 23 |
22 namespace content { | 24 namespace content { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 | 62 |
61 // Is |id| in the set of pending extensions? | 63 // Is |id| in the set of pending extensions? |
62 bool IsIdPending(const std::string& id) const; | 64 bool IsIdPending(const std::string& id) const; |
63 | 65 |
64 // Returns true if there are any extensions pending. | 66 // Returns true if there are any extensions pending. |
65 bool HasPendingExtensions() const; | 67 bool HasPendingExtensions() const; |
66 | 68 |
67 // Whether there is pending extension install from sync. | 69 // Whether there is pending extension install from sync. |
68 bool HasPendingExtensionFromSync() const; | 70 bool HasPendingExtensionFromSync() const; |
69 | 71 |
72 // Notify the manager that we are reinstalling the policy force-installed | |
lazyboy
2016/09/02 19:21:53
nit: Notifies the manager...
Also I'd be more clea
asargent_no_longer_on_chrome
2016/09/09 03:30:44
Done. Used "ExpectPolicyReinstallForCorruption" ("
| |
73 // extension with |id|. | |
74 void ExpectPolicyReinstall(const std::string& id); | |
lazyboy
2016/09/02 19:21:53
nit: use ExtensionId (which is a string) for new e
asargent_no_longer_on_chrome
2016/09/09 03:30:44
Done.
| |
75 | |
76 // Are we expecting a reinstall of the extension with |id|? | |
77 bool IsPolicyReinstallExpected(const std::string& id) const; | |
78 | |
70 // Adds an extension in a pending state; the extension with the | 79 // Adds an extension in a pending state; the extension with the |
71 // given info will be installed on the next auto-update cycle. | 80 // given info will be installed on the next auto-update cycle. |
72 // Return true if the extension was added. Will return false | 81 // Return true if the extension was added. Will return false |
73 // if the extension is pending from another source which overrides | 82 // if the extension is pending from another source which overrides |
74 // sync installs (such as a policy extension) or if the extension | 83 // sync installs (such as a policy extension) or if the extension |
75 // is already installed. | 84 // is already installed. |
76 // After installation, the extension will be granted permissions iff | 85 // After installation, the extension will be granted permissions iff |
77 // |version| is valid and matches the actual installed version. | 86 // |version| is valid and matches the actual installed version. |
78 bool AddFromSync( | 87 bool AddFromSync( |
79 const std::string& id, | 88 const std::string& id, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 // Add a pending extension record directly. Used for unit tests that need | 142 // Add a pending extension record directly. Used for unit tests that need |
134 // to set an inital state. Use friendship to allow the tests to call this | 143 // to set an inital state. Use friendship to allow the tests to call this |
135 // method. | 144 // method. |
136 void AddForTesting(const PendingExtensionInfo& pending_extension_info); | 145 void AddForTesting(const PendingExtensionInfo& pending_extension_info); |
137 | 146 |
138 // The BrowserContext with which the manager is associated. | 147 // The BrowserContext with which the manager is associated. |
139 content::BrowserContext* context_; | 148 content::BrowserContext* context_; |
140 | 149 |
141 PendingExtensionList pending_extension_list_; | 150 PendingExtensionList pending_extension_list_; |
142 | 151 |
152 // A set of policy force-installed extension ids that are being reinstalled | |
153 // due to corruption, mapped to the time we detected the corruption. | |
154 std::map<std::string, base::TimeTicks> expected_policy_reinstalls_; | |
155 | |
143 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, | 156 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, |
144 UpdatePendingExtensionAlreadyInstalled); | 157 UpdatePendingExtensionAlreadyInstalled); |
145 friend class ExtensionUpdaterTest; | 158 friend class ExtensionUpdaterTest; |
146 friend void SetupPendingExtensionManagerForTest( | 159 friend void SetupPendingExtensionManagerForTest( |
147 int count, const GURL& update_url, | 160 int count, const GURL& update_url, |
148 PendingExtensionManager* pending_extension_manager); | 161 PendingExtensionManager* pending_extension_manager); |
149 | 162 |
150 DISALLOW_COPY_AND_ASSIGN(PendingExtensionManager); | 163 DISALLOW_COPY_AND_ASSIGN(PendingExtensionManager); |
151 }; | 164 }; |
152 | 165 |
153 } // namespace extensions | 166 } // namespace extensions |
154 | 167 |
155 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ | 168 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ |
OLD | NEW |