OLD | NEW |
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 #include "chrome/browser/extensions/extension_updater.h" | 5 #include "chrome/browser/extensions/extension_updater.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 // TODO(skerner): Move the determination of what gets fetched into | 1018 // TODO(skerner): Move the determination of what gets fetched into |
1019 // class PendingExtensionManager. | 1019 // class PendingExtensionManager. |
1020 Extension::Location location = iter->second.install_source(); | 1020 Extension::Location location = iter->second.install_source(); |
1021 if (location != Extension::EXTERNAL_PREF && | 1021 if (location != Extension::EXTERNAL_PREF && |
1022 location != Extension::EXTERNAL_REGISTRY) { | 1022 location != Extension::EXTERNAL_REGISTRY) { |
1023 fetches_builder.AddPendingExtension(iter->first, iter->second); | 1023 fetches_builder.AddPendingExtension(iter->first, iter->second); |
1024 pending_ids.insert(iter->first); | 1024 pending_ids.insert(iter->first); |
1025 } | 1025 } |
1026 } | 1026 } |
1027 | 1027 |
1028 const ExtensionList* extensions = service_->extensions(); | 1028 const ExtensionSet* extensions = service_->extensions(); |
1029 for (ExtensionList::const_iterator iter = extensions->begin(); | 1029 for (ExtensionSet::const_iterator iter = extensions->begin(); |
1030 iter != extensions->end(); ++iter) { | 1030 iter != extensions->end(); ++iter) { |
1031 // An extension might be overwritten by policy, and have its update url | 1031 // An extension might be overwritten by policy, and have its update url |
1032 // changed. Make sure existing extensions aren't fetched again, if a | 1032 // changed. Make sure existing extensions aren't fetched again, if a |
1033 // pending fetch for an extension with the same id already exists. | 1033 // pending fetch for an extension with the same id already exists. |
1034 if (!ContainsKey(pending_ids, (*iter)->id())) { | 1034 if (!ContainsKey(pending_ids, (*iter)->id())) { |
1035 fetches_builder.AddExtension(**iter); | 1035 fetches_builder.AddExtension(**iter); |
1036 } | 1036 } |
1037 } | 1037 } |
1038 | 1038 |
1039 fetches_builder.ReportStats(); | 1039 fetches_builder.ReportStats(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 std::set<std::string>::const_iterator i; | 1244 std::set<std::string>::const_iterator i; |
1245 for (i = ids.begin(); i != ids.end(); ++i) | 1245 for (i = ids.begin(); i != ids.end(); ++i) |
1246 in_progress_ids_.insert(*i); | 1246 in_progress_ids_.insert(*i); |
1247 } | 1247 } |
1248 | 1248 |
1249 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { | 1249 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { |
1250 std::set<std::string>::const_iterator i; | 1250 std::set<std::string>::const_iterator i; |
1251 for (i = ids.begin(); i != ids.end(); ++i) | 1251 for (i = ids.begin(); i != ids.end(); ++i) |
1252 in_progress_ids_.erase(*i); | 1252 in_progress_ids_.erase(*i); |
1253 } | 1253 } |
OLD | NEW |