| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 18 matching lines...) Expand all Loading... |
| 29 class PrefService; | 29 class PrefService; |
| 30 | 30 |
| 31 // To save on server resources we can request updates for multiple extensions | 31 // To save on server resources we can request updates for multiple extensions |
| 32 // in one manifest check. This class helps us keep track of the id's for a | 32 // in one manifest check. This class helps us keep track of the id's for a |
| 33 // given fetch, building up the actual URL, and what if anything to include | 33 // given fetch, building up the actual URL, and what if anything to include |
| 34 // in the ping parameter. | 34 // in the ping parameter. |
| 35 class ManifestFetchData { | 35 class ManifestFetchData { |
| 36 public: | 36 public: |
| 37 static const int kNeverPinged = -1; | 37 static const int kNeverPinged = -1; |
| 38 | 38 |
| 39 explicit ManifestFetchData(GURL update_url) : base_url_(update_url), | 39 explicit ManifestFetchData(GURL update_url); |
| 40 full_url_(update_url) {} | 40 ~ManifestFetchData(); |
| 41 | 41 |
| 42 // Returns true if this extension information was successfully added. If the | 42 // Returns true if this extension information was successfully added. If the |
| 43 // return value is false it means the full_url would have become too long, and | 43 // return value is false it means the full_url would have become too long, and |
| 44 // this ManifestFetchData object remains unchanged. | 44 // this ManifestFetchData object remains unchanged. |
| 45 bool AddExtension(std::string id, std::string version, int ping_days); | 45 bool AddExtension(std::string id, std::string version, int ping_days); |
| 46 | 46 |
| 47 const GURL& base_url() const { return base_url_; } | 47 const GURL& base_url() const { return base_url_; } |
| 48 const GURL& full_url() const { return full_url_; } | 48 const GURL& full_url() const { return full_url_; } |
| 49 int extension_count() { return extension_ids_.size(); } | 49 int extension_count() { return extension_ids_.size(); } |
| 50 const std::set<std::string>& extension_ids() const { return extension_ids_; } | 50 const std::set<std::string>& extension_ids() const { return extension_ids_; } |
| 51 | 51 |
| 52 // Returns true if the given id is included in this manifest fetch. | 52 // Returns true if the given id is included in this manifest fetch. |
| 53 bool Includes(std::string extension_id) const { | 53 bool Includes(std::string extension_id) const; |
| 54 return extension_ids_.find(extension_id) != extension_ids_.end(); | |
| 55 } | |
| 56 | 54 |
| 57 // Returns true if a ping parameter was added to full_url for this extension | 55 // Returns true if a ping parameter was added to full_url for this extension |
| 58 // id. | 56 // id. |
| 59 bool DidPing(std::string extension_id) const; | 57 bool DidPing(std::string extension_id) const; |
| 60 | 58 |
| 61 private: | 59 private: |
| 62 // Returns true if we should include a ping parameter for a given number of | 60 // Returns true if we should include a ping parameter for a given number of |
| 63 // days. | 61 // days. |
| 64 bool ShouldPing(int days) const; | 62 bool ShouldPing(int days) const; |
| 65 | 63 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 274 |
| 277 PrefService* prefs_; | 275 PrefService* prefs_; |
| 278 | 276 |
| 279 scoped_refptr<ExtensionUpdaterFileHandler> file_handler_; | 277 scoped_refptr<ExtensionUpdaterFileHandler> file_handler_; |
| 280 bool blacklist_checks_enabled_; | 278 bool blacklist_checks_enabled_; |
| 281 | 279 |
| 282 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 280 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
| 283 }; | 281 }; |
| 284 | 282 |
| 285 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ | 283 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UPDATER_H_ |
| OLD | NEW |