Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: extensions/browser/updater/extension_downloader.h

Issue 2299203004: Attempt to repair corrupt enterprise policy force-installed extensions (Closed)
Patch Set: switched to using installsource, addressed review comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ 5 #ifndef EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_
6 #define EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ 6 #define EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // The |request_id| is passed on as is to the various |delegate_| callbacks. 73 // The |request_id| is passed on as is to the various |delegate_| callbacks.
74 // This is used for example by ExtensionUpdater to keep track of when 74 // This is used for example by ExtensionUpdater to keep track of when
75 // potentially concurrent update checks complete. 75 // potentially concurrent update checks complete.
76 bool AddExtension(const Extension& extension, int request_id); 76 bool AddExtension(const Extension& extension, int request_id);
77 77
78 // Adds extension |id| to the list of extensions to check for updates. 78 // Adds extension |id| to the list of extensions to check for updates.
79 // Returns false if the |id| can't be updated due to invalid details. 79 // Returns false if the |id| can't be updated due to invalid details.
80 // In that case, no callbacks will be performed on the |delegate_|. 80 // In that case, no callbacks will be performed on the |delegate_|.
81 // The |request_id| is passed on as is to the various |delegate_| callbacks. 81 // The |request_id| is passed on as is to the various |delegate_| callbacks.
82 // This is used for example by ExtensionUpdater to keep track of when 82 // This is used for example by ExtensionUpdater to keep track of when
83 // potentially concurrent update checks complete. 83 // potentially concurrent update checks complete. The |is_corrupt_reinstall|
84 // parameter is used to indicate in the request that we detected corruption in
85 // the local copy of the extension and we want to perform a reinstall of it.
84 bool AddPendingExtension(const std::string& id, 86 bool AddPendingExtension(const std::string& id,
85 const GURL& update_url, 87 const GURL& update_url,
88 bool is_corrupt_reinstall,
86 int request_id); 89 int request_id);
87 90
88 // Schedules a fetch of the manifest of all the extensions added with 91 // Schedules a fetch of the manifest of all the extensions added with
89 // AddExtension() and AddPendingExtension(). 92 // AddExtension() and AddPendingExtension().
90 void StartAllPending(ExtensionCache* cache); 93 void StartAllPending(ExtensionCache* cache);
91 94
92 // Schedules an update check of the blacklist. 95 // Schedules an update check of the blacklist.
93 void StartBlacklistUpdate(const std::string& version, 96 void StartBlacklistUpdate(const std::string& version,
94 const ManifestFetchData::PingData& ping_data, 97 const ManifestFetchData::PingData& ping_data,
95 int request_id); 98 int request_id);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 }; 173 };
171 174
172 // Indicates the type of credentials to include with this fetch. 175 // Indicates the type of credentials to include with this fetch.
173 CredentialsMode credentials; 176 CredentialsMode credentials;
174 177
175 // Counts the number of times OAuth2 authentication has been attempted for 178 // Counts the number of times OAuth2 authentication has been attempted for
176 // this fetch. 179 // this fetch.
177 int oauth2_attempt_count; 180 int oauth2_attempt_count;
178 }; 181 };
179 182
183 // Parameters for special cases that aren't used for most requests.
184 struct ExtraParams {
185 // Additional data to be passed up in the update request.
186 std::string update_url_data;
187
188 // Indicates whether this extension is being reinstalled due to corruption.
189 bool is_corrupt_reinstall;
190
191 ExtraParams();
192 };
193
180 // Helper for AddExtension() and AddPendingExtension(). 194 // Helper for AddExtension() and AddPendingExtension().
181 bool AddExtensionData(const std::string& id, 195 bool AddExtensionData(const std::string& id,
182 const base::Version& version, 196 const base::Version& version,
183 Manifest::Type extension_type, 197 Manifest::Type extension_type,
184 const GURL& extension_update_url, 198 const GURL& extension_update_url,
185 const std::string& update_url_data, 199 const ExtraParams& extra,
186 int request_id); 200 int request_id);
187 201
188 // Adds all recorded stats taken so far to histogram counts. 202 // Adds all recorded stats taken so far to histogram counts.
189 void ReportStats() const; 203 void ReportStats() const;
190 204
191 // Begins an update check. 205 // Begins an update check.
192 void StartUpdateCheck(std::unique_ptr<ManifestFetchData> fetch_data); 206 void StartUpdateCheck(std::unique_ptr<ManifestFetchData> fetch_data);
193 207
194 // Called by RequestQueue when a new manifest fetch request is started. 208 // Called by RequestQueue when a new manifest fetch request is started.
195 void CreateManifestFetcher(); 209 void CreateManifestFetcher();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 341
328 // Used to create WeakPtrs to |this|. 342 // Used to create WeakPtrs to |this|.
329 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; 343 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_;
330 344
331 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); 345 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader);
332 }; 346 };
333 347
334 } // namespace extensions 348 } // namespace extensions
335 349
336 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ 350 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | extensions/browser/updater/extension_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698