OLD | NEW |
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 CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <stack> | 10 #include <stack> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "base/timer.h" | 19 #include "base/timer.h" |
20 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" | 20 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" |
21 #include "chrome/browser/extensions/updater/manifest_fetch_data.h" | 21 #include "chrome/browser/extensions/updater/manifest_fetch_data.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
25 | 25 |
26 class ExtensionPrefs; | 26 class ExtensionPrefs; |
27 class ExtensionServiceInterface; | 27 class ExtensionServiceInterface; |
| 28 class ExtensionSet; |
28 class PrefService; | 29 class PrefService; |
29 class Profile; | 30 class Profile; |
30 | 31 |
31 namespace extensions { | 32 namespace extensions { |
32 | 33 |
33 class ExtensionDownloader; | 34 class ExtensionDownloader; |
34 class ExtensionUpdaterTest; | 35 class ExtensionUpdaterTest; |
35 | 36 |
36 // A class for doing auto-updates of installed Extensions. Used like this: | 37 // A class for doing auto-updates of installed Extensions. Used like this: |
37 // | 38 // |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 103 |
103 // Computes when to schedule the first update check. | 104 // Computes when to schedule the first update check. |
104 base::TimeDelta DetermineFirstCheckDelay(); | 105 base::TimeDelta DetermineFirstCheckDelay(); |
105 | 106 |
106 // Sets the timer to call TimerFired after roughly |target_delay| from now. | 107 // Sets the timer to call TimerFired after roughly |target_delay| from now. |
107 // To help spread load evenly on servers, this method adds some random | 108 // To help spread load evenly on servers, this method adds some random |
108 // jitter. It also saves the scheduled time so it can be reloaded on | 109 // jitter. It also saves the scheduled time so it can be reloaded on |
109 // browser restart. | 110 // browser restart. |
110 void ScheduleNextCheck(const base::TimeDelta& target_delay); | 111 void ScheduleNextCheck(const base::TimeDelta& target_delay); |
111 | 112 |
| 113 // Add fetch records for extensions that are installed to the downloader, |
| 114 // ignoring |pending_ids| so the extension isn't fetched again. |
| 115 void AddToDownloader(const ExtensionSet* extensions, |
| 116 const std::set<std::string>& pending_ids); |
| 117 |
112 // BaseTimer::ReceiverMethod callback. | 118 // BaseTimer::ReceiverMethod callback. |
113 void TimerFired(); | 119 void TimerFired(); |
114 | 120 |
115 // Posted by CheckSoon(). | 121 // Posted by CheckSoon(). |
116 void DoCheckSoon(); | 122 void DoCheckSoon(); |
117 | 123 |
118 // Implenentation of ExtensionDownloaderDelegate. | 124 // Implenentation of ExtensionDownloaderDelegate. |
119 virtual void OnExtensionDownloadFailed(const std::string& id, | 125 virtual void OnExtensionDownloadFailed(const std::string& id, |
120 Error error, | 126 Error error, |
121 const PingResult& ping) OVERRIDE; | 127 const PingResult& ping) OVERRIDE; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 195 |
190 // Fetched CRX files waiting to be installed. | 196 // Fetched CRX files waiting to be installed. |
191 std::stack<FetchedCRXFile> fetched_crx_files_; | 197 std::stack<FetchedCRXFile> fetched_crx_files_; |
192 | 198 |
193 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 199 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
194 }; | 200 }; |
195 | 201 |
196 } // namespace extensions | 202 } // namespace extensions |
197 | 203 |
198 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 204 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
OLD | NEW |