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

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

Issue 1887253002: Rate limit programmatic update checks for extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for idleness waiting problem caused by crrev.com/388245 Created 4 years, 8 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
« no previous file with comments | « extensions/browser/event_router.h ('k') | extensions/browser/updater/extension_downloader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 10 #include <set>
(...skipping 28 matching lines...) Expand all
39 39
40 struct UpdateDetails { 40 struct UpdateDetails {
41 UpdateDetails(const std::string& id, const base::Version& version); 41 UpdateDetails(const std::string& id, const base::Version& version);
42 ~UpdateDetails(); 42 ~UpdateDetails();
43 43
44 std::string id; 44 std::string id;
45 base::Version version; 45 base::Version version;
46 }; 46 };
47 47
48 class ExtensionCache; 48 class ExtensionCache;
49 class ExtensionDownloaderTestDelegate;
49 class ExtensionUpdaterTest; 50 class ExtensionUpdaterTest;
50 51
51 // A class that checks for updates of a given list of extensions, and downloads 52 // A class that checks for updates of a given list of extensions, and downloads
52 // the crx file when updates are found. It uses a |ExtensionDownloaderDelegate| 53 // the crx file when updates are found. It uses a |ExtensionDownloaderDelegate|
53 // that takes ownership of the downloaded crx files, and handles events during 54 // that takes ownership of the downloaded crx files, and handles events during
54 // the update check. 55 // the update check.
55 class ExtensionDownloader : public net::URLFetcherDelegate, 56 class ExtensionDownloader : public net::URLFetcherDelegate,
56 public OAuth2TokenService::Consumer { 57 public OAuth2TokenService::Consumer {
57 public: 58 public:
58 // A closure which constructs a new ExtensionDownloader to be owned by the 59 // A closure which constructs a new ExtensionDownloader to be owned by the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 108 }
108 109
109 void set_ping_enabled_domain(const std::string& domain) { 110 void set_ping_enabled_domain(const std::string& domain) {
110 ping_enabled_domain_ = domain; 111 ping_enabled_domain_ = domain;
111 } 112 }
112 113
113 void set_enable_extra_update_metrics(bool enable) { 114 void set_enable_extra_update_metrics(bool enable) {
114 enable_extra_update_metrics_ = enable; 115 enable_extra_update_metrics_ = enable;
115 } 116 }
116 117
118 // Sets a test delegate to use by any instances of this class. The |delegate|
119 // should outlive all instances.
120 static void set_test_delegate(ExtensionDownloaderTestDelegate* delegate);
121
117 // These are needed for unit testing, to help identify the correct mock 122 // These are needed for unit testing, to help identify the correct mock
118 // URLFetcher objects. 123 // URLFetcher objects.
119 static const int kManifestFetcherId = 1; 124 static const int kManifestFetcherId = 1;
120 static const int kExtensionFetcherId = 2; 125 static const int kExtensionFetcherId = 2;
121 126
122 // Update AppID for extension blacklist. 127 // Update AppID for extension blacklist.
123 static const char kBlacklistAppID[]; 128 static const char kBlacklistAppID[];
124 129
125 static const int kMaxRetries = 10; 130 static const int kMaxRetries = 10;
126 131
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 333
329 // Used to create WeakPtrs to |this|. 334 // Used to create WeakPtrs to |this|.
330 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; 335 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_;
331 336
332 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); 337 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader);
333 }; 338 };
334 339
335 } // namespace extensions 340 } // namespace extensions
336 341
337 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_ 342 #endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_H_
OLDNEW
« no previous file with comments | « extensions/browser/event_router.h ('k') | extensions/browser/updater/extension_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698