Chromium Code Reviews| 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 #include "chrome/browser/extensions/updater/extension_updater.h" | 5 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 15 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "chrome/browser/extensions/api/module/module.h" | |
| 19 #include "chrome/browser/extensions/blacklist.h" | 20 #include "chrome/browser/extensions/blacklist.h" |
| 20 #include "chrome/browser/extensions/crx_installer.h" | 21 #include "chrome/browser/extensions/crx_installer.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/pending_extension_manager.h" | 23 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 23 #include "chrome/browser/extensions/updater/extension_downloader.h" | 24 #include "chrome/browser/extensions/updater/extension_downloader.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
| 26 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
| 27 #include "chrome/common/extensions/extension_set.h" | 28 #include "chrome/common/extensions/extension_set.h" |
| 28 #include "chrome/common/extensions/manifest.h" | 29 #include "chrome/common/extensions/manifest.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 extension_prefs_->LastPingDay(id)); | 538 extension_prefs_->LastPingDay(id)); |
| 538 ping_data->is_enabled = service_->IsExtensionEnabled(id); | 539 ping_data->is_enabled = service_->IsExtensionEnabled(id); |
| 539 ping_data->active_days = | 540 ping_data->active_days = |
| 540 CalculateActivePingDays(extension_prefs_->LastActivePingDay(id), | 541 CalculateActivePingDays(extension_prefs_->LastActivePingDay(id), |
| 541 extension_prefs_->GetActiveBit(id)); | 542 extension_prefs_->GetActiveBit(id)); |
| 542 return true; | 543 return true; |
| 543 } | 544 } |
| 544 | 545 |
| 545 std::string ExtensionUpdater::GetUpdateUrlData(const std::string& id) { | 546 std::string ExtensionUpdater::GetUpdateUrlData(const std::string& id) { |
| 546 DCHECK(alive_); | 547 DCHECK(alive_); |
| 547 return extension_prefs_->GetUpdateUrlData(id); | 548 std::string data; |
| 549 extension_prefs_->ReadPrefAsString(id, extension::kUpdateURLData, &data); | |
|
Yoyo Zhou
2013/05/15 18:49:49
I think it'd be better to have an accessor in modu
Devlin
2013/05/15 23:12:29
Agreed, and done.
| |
| 550 return data; | |
| 548 } | 551 } |
| 549 | 552 |
| 550 bool ExtensionUpdater::IsExtensionPending(const std::string& id) { | 553 bool ExtensionUpdater::IsExtensionPending(const std::string& id) { |
| 551 DCHECK(alive_); | 554 DCHECK(alive_); |
| 552 return service_->pending_extension_manager()->IsIdPending(id); | 555 return service_->pending_extension_manager()->IsIdPending(id); |
| 553 } | 556 } |
| 554 | 557 |
| 555 bool ExtensionUpdater::GetExtensionExistingVersion(const std::string& id, | 558 bool ExtensionUpdater::GetExtensionExistingVersion(const std::string& id, |
| 556 std::string* version) { | 559 std::string* version) { |
| 557 DCHECK(alive_); | 560 DCHECK(alive_); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 const InProgressCheck& request = requests_in_progress_[request_id]; | 690 const InProgressCheck& request = requests_in_progress_[request_id]; |
| 688 if (request.in_progress_ids_.empty()) { | 691 if (request.in_progress_ids_.empty()) { |
| 689 VLOG(2) << "Finished update check " << request_id; | 692 VLOG(2) << "Finished update check " << request_id; |
| 690 if (!request.callback.is_null()) | 693 if (!request.callback.is_null()) |
| 691 request.callback.Run(); | 694 request.callback.Run(); |
| 692 requests_in_progress_.erase(request_id); | 695 requests_in_progress_.erase(request_id); |
| 693 } | 696 } |
| 694 } | 697 } |
| 695 | 698 |
| 696 } // namespace extensions | 699 } // namespace extensions |
| OLD | NEW |