OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 static const char* kBlacklistAppID; | 249 static const char* kBlacklistAppID; |
250 | 250 |
251 // Does common work from constructors. | 251 // Does common work from constructors. |
252 void Init(); | 252 void Init(); |
253 | 253 |
254 // Computes when to schedule the first update check. | 254 // Computes when to schedule the first update check. |
255 base::TimeDelta DetermineFirstCheckDelay(); | 255 base::TimeDelta DetermineFirstCheckDelay(); |
256 | 256 |
257 // content::URLFetcherDelegate interface. | 257 // content::URLFetcherDelegate interface. |
258 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 258 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
259 | 259 |
260 // These do the actual work when a URL fetch completes. | 260 // These do the actual work when a URL fetch completes. |
261 virtual void OnManifestFetchComplete(const GURL& url, | 261 virtual void OnManifestFetchComplete(const GURL& url, |
262 const net::URLRequestStatus& status, | 262 const net::URLRequestStatus& status, |
263 int response_code, | 263 int response_code, |
264 const std::string& data); | 264 const std::string& data); |
265 | 265 |
266 virtual void OnCRXFetchComplete(const URLFetcher* source, | 266 virtual void OnCRXFetchComplete(const content::URLFetcher* source, |
267 const GURL& url, | 267 const GURL& url, |
268 const net::URLRequestStatus& status, | 268 const net::URLRequestStatus& status, |
269 int response_code); | 269 int response_code); |
270 | 270 |
271 // Called when a crx file has been written into a temp file, and is ready | 271 // Called when a crx file has been written into a temp file, and is ready |
272 // to be installed. | 272 // to be installed. |
273 void OnCRXFileWritten(const std::string& id, | 273 void OnCRXFileWritten(const std::string& id, |
274 const FilePath& path, | 274 const FilePath& path, |
275 const GURL& download_url); | 275 const GURL& download_url); |
276 | 276 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 virtual void Observe(int type, | 339 virtual void Observe(int type, |
340 const content::NotificationSource& source, | 340 const content::NotificationSource& source, |
341 const content::NotificationDetails& details) OVERRIDE; | 341 const content::NotificationDetails& details) OVERRIDE; |
342 | 342 |
343 // Whether Start() has been called but not Stop(). | 343 // Whether Start() has been called but not Stop(). |
344 bool alive_; | 344 bool alive_; |
345 | 345 |
346 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; | 346 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; |
347 | 347 |
348 // Outstanding url fetch requests for manifests and updates. | 348 // Outstanding url fetch requests for manifests and updates. |
349 scoped_ptr<URLFetcher> manifest_fetcher_; | 349 scoped_ptr<content::URLFetcher> manifest_fetcher_; |
350 scoped_ptr<URLFetcher> extension_fetcher_; | 350 scoped_ptr<content::URLFetcher> extension_fetcher_; |
351 | 351 |
352 // Pending manifests and extensions to be fetched when the appropriate fetcher | 352 // Pending manifests and extensions to be fetched when the appropriate fetcher |
353 // is available. | 353 // is available. |
354 std::deque<ManifestFetchData*> manifests_pending_; | 354 std::deque<ManifestFetchData*> manifests_pending_; |
355 std::deque<ExtensionFetch> extensions_pending_; | 355 std::deque<ExtensionFetch> extensions_pending_; |
356 | 356 |
357 // The manifest currently being fetched (if any). | 357 // The manifest currently being fetched (if any). |
358 scoped_ptr<ManifestFetchData> current_manifest_fetch_; | 358 scoped_ptr<ManifestFetchData> current_manifest_fetch_; |
359 | 359 |
360 // The extension currently being fetched (if any). | 360 // The extension currently being fetched (if any). |
(...skipping 25 matching lines...) Expand all Loading... |
386 // Fetched CRX files waiting to be installed. | 386 // Fetched CRX files waiting to be installed. |
387 std::stack<FetchedCRXFile> fetched_crx_files_; | 387 std::stack<FetchedCRXFile> fetched_crx_files_; |
388 | 388 |
389 FRIEND_TEST(ExtensionUpdaterTest, TestStartUpdateCheckMemory); | 389 FRIEND_TEST(ExtensionUpdaterTest, TestStartUpdateCheckMemory); |
390 FRIEND_TEST(ExtensionUpdaterTest, TestAfterStopBehavior); | 390 FRIEND_TEST(ExtensionUpdaterTest, TestAfterStopBehavior); |
391 | 391 |
392 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 392 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
393 }; | 393 }; |
394 | 394 |
395 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ | 395 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ |
OLD | NEW |