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 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <stack> | 11 #include <stack> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/scoped_observer.h" | 20 #include "base/scoped_observer.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/timer/timer.h" | 22 #include "base/timer/timer.h" |
23 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" | 23 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" |
24 #include "chrome/browser/extensions/updater/manifest_fetch_data.h" | 24 #include "chrome/browser/extensions/updater/manifest_fetch_data.h" |
25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
27 #include "extensions/browser/extension_registry_observer.h" | 27 #include "extensions/browser/extension_registry_observer.h" |
| 28 #include "google_apis/gaia/identity_provider.h" |
28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
29 | 30 |
30 class ExtensionServiceInterface; | 31 class ExtensionServiceInterface; |
31 class PrefService; | 32 class PrefService; |
32 class Profile; | 33 class Profile; |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 class BrowserContext; | 36 class BrowserContext; |
36 } | 37 } |
37 | 38 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 }; | 81 }; |
81 | 82 |
82 // Holds a pointer to the passed |service|, using it for querying installed | 83 // Holds a pointer to the passed |service|, using it for querying installed |
83 // extensions and installing updated ones. The |frequency_seconds| parameter | 84 // extensions and installing updated ones. The |frequency_seconds| parameter |
84 // controls how often update checks are scheduled. | 85 // controls how often update checks are scheduled. |
85 ExtensionUpdater(ExtensionServiceInterface* service, | 86 ExtensionUpdater(ExtensionServiceInterface* service, |
86 ExtensionPrefs* extension_prefs, | 87 ExtensionPrefs* extension_prefs, |
87 PrefService* prefs, | 88 PrefService* prefs, |
88 Profile* profile, | 89 Profile* profile, |
89 int frequency_seconds, | 90 int frequency_seconds, |
90 ExtensionCache* cache); | 91 ExtensionCache* cache, |
| 92 scoped_ptr<IdentityProvider> identity_provider); |
91 | 93 |
92 virtual ~ExtensionUpdater(); | 94 virtual ~ExtensionUpdater(); |
93 | 95 |
94 // Starts the updater running. Should be called at most once. | 96 // Starts the updater running. Should be called at most once. |
95 void Start(); | 97 void Start(); |
96 | 98 |
97 // Stops the updater running, cancelling any outstanding update manifest and | 99 // Stops the updater running, cancelling any outstanding update manifest and |
98 // crx downloads. Does not cancel any in-progress installs. | 100 // crx downloads. Does not cancel any in-progress installs. |
99 void Stop(); | 101 void Stop(); |
100 | 102 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 bool crx_install_is_running_; | 265 bool crx_install_is_running_; |
264 | 266 |
265 // Fetched CRX files waiting to be installed. | 267 // Fetched CRX files waiting to be installed. |
266 std::stack<FetchedCRXFile> fetched_crx_files_; | 268 std::stack<FetchedCRXFile> fetched_crx_files_; |
267 FetchedCRXFile current_crx_file_; | 269 FetchedCRXFile current_crx_file_; |
268 | 270 |
269 CheckParams default_params_; | 271 CheckParams default_params_; |
270 | 272 |
271 ExtensionCache* extension_cache_; | 273 ExtensionCache* extension_cache_; |
272 | 274 |
| 275 // Provided to the ExtensionDownloader to enable OAuth2 support. |
| 276 scoped_ptr<IdentityProvider> webstore_identity_provider_; |
| 277 |
273 // Keeps track of when an extension tried to update itself, so we can throttle | 278 // Keeps track of when an extension tried to update itself, so we can throttle |
274 // checks to prevent too many requests from being made. | 279 // checks to prevent too many requests from being made. |
275 std::map<std::string, ThrottleInfo> throttle_info_; | 280 std::map<std::string, ThrottleInfo> throttle_info_; |
276 | 281 |
277 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 282 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
278 }; | 283 }; |
279 | 284 |
280 } // namespace extensions | 285 } // namespace extensions |
281 | 286 |
282 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 287 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
OLD | NEW |