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

Side by Side Diff: chrome/browser/extensions/extension_updater.h

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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>
11 #include <set> 11 #include <set>
12 #include <stack> 12 #include <stack>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/scoped_temp_dir.h" 21 #include "base/scoped_temp_dir.h"
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "base/timer.h" 23 #include "base/timer.h"
24 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/common/extensions/update_manifest.h" 25 #include "chrome/common/extensions/update_manifest.h"
26 #include "content/common/net/url_fetcher.h" 26 #include "content/public/common/url_fetcher_delegate.h"
27 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
28 28
29 class Extension; 29 class Extension;
30 class ExtensionPrefs; 30 class ExtensionPrefs;
31 class ExtensionUpdaterTest; 31 class ExtensionUpdaterTest;
32 class PrefService; 32 class PrefService;
33 class Profile; 33 class Profile;
34 class SafeManifestParser; 34 class SafeManifestParser;
35 35
36 // To save on server resources we can request updates for multiple extensions 36 // To save on server resources we can request updates for multiple extensions
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 }; 158 };
159 159
160 // A class for doing auto-updates of installed Extensions. Used like this: 160 // A class for doing auto-updates of installed Extensions. Used like this:
161 // 161 //
162 // ExtensionUpdater* updater = new ExtensionUpdater(my_extensions_service, 162 // ExtensionUpdater* updater = new ExtensionUpdater(my_extensions_service,
163 // pref_service, 163 // pref_service,
164 // update_frequency_secs); 164 // update_frequency_secs);
165 // updater->Start(); 165 // updater->Start();
166 // .... 166 // ....
167 // updater->Stop(); 167 // updater->Stop();
168 class ExtensionUpdater : public URLFetcher::Delegate, 168 class ExtensionUpdater : public content::URLFetcherDelegate,
169 public content::NotificationObserver { 169 public content::NotificationObserver {
170 public: 170 public:
171 // Holds a pointer to the passed |service|, using it for querying installed 171 // Holds a pointer to the passed |service|, using it for querying installed
172 // extensions and installing updated ones. The |frequency_seconds| parameter 172 // extensions and installing updated ones. The |frequency_seconds| parameter
173 // controls how often update checks are scheduled. 173 // controls how often update checks are scheduled.
174 ExtensionUpdater(ExtensionServiceInterface* service, 174 ExtensionUpdater(ExtensionServiceInterface* service,
175 ExtensionPrefs* extension_prefs, 175 ExtensionPrefs* extension_prefs,
176 PrefService* prefs, 176 PrefService* prefs,
177 Profile* profile, 177 Profile* profile,
178 int frequency_seconds); 178 int frequency_seconds);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 static const int kExtensionFetcherId = 2; 243 static const int kExtensionFetcherId = 2;
244 244
245 static const char* kBlacklistAppID; 245 static const char* kBlacklistAppID;
246 246
247 // Does common work from constructors. 247 // Does common work from constructors.
248 void Init(); 248 void Init();
249 249
250 // Computes when to schedule the first update check. 250 // Computes when to schedule the first update check.
251 base::TimeDelta DetermineFirstCheckDelay(); 251 base::TimeDelta DetermineFirstCheckDelay();
252 252
253 // URLFetcher::Delegate interface. 253 // content::URLFetcherDelegate interface.
254 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; 254 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
255 255
256 // These do the actual work when a URL fetch completes. 256 // These do the actual work when a URL fetch completes.
257 virtual void OnManifestFetchComplete(const GURL& url, 257 virtual void OnManifestFetchComplete(const GURL& url,
258 const net::URLRequestStatus& status, 258 const net::URLRequestStatus& status,
259 int response_code, 259 int response_code,
260 const std::string& data); 260 const std::string& data);
261 261
262 virtual void OnCRXFetchComplete(const URLFetcher* source, 262 virtual void OnCRXFetchComplete(const URLFetcher* source,
263 const GURL& url, 263 const GURL& url,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // Fetched CRX files waiting to be installed. 382 // Fetched CRX files waiting to be installed.
383 std::stack<FetchedCRXFile> fetched_crx_files_; 383 std::stack<FetchedCRXFile> fetched_crx_files_;
384 384
385 FRIEND_TEST(ExtensionUpdaterTest, TestStartUpdateCheckMemory); 385 FRIEND_TEST(ExtensionUpdaterTest, TestStartUpdateCheckMemory);
386 FRIEND_TEST(ExtensionUpdaterTest, TestAfterStopBehavior); 386 FRIEND_TEST(ExtensionUpdaterTest, TestAfterStopBehavior);
387 387
388 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); 388 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater);
389 }; 389 };
390 390
391 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ 391 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698