| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pending_extension_manager.h" | 5 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const ExtensionId& id) { | 99 const ExtensionId& id) { |
| 100 expected_policy_reinstalls_[id] = base::TimeTicks::Now(); | 100 expected_policy_reinstalls_[id] = base::TimeTicks::Now(); |
| 101 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptPolicyExtensionDetected", true); | 101 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptPolicyExtensionDetected", true); |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool PendingExtensionManager::IsPolicyReinstallForCorruptionExpected( | 104 bool PendingExtensionManager::IsPolicyReinstallForCorruptionExpected( |
| 105 const ExtensionId& id) const { | 105 const ExtensionId& id) const { |
| 106 return base::ContainsKey(expected_policy_reinstalls_, id); | 106 return base::ContainsKey(expected_policy_reinstalls_, id); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool PendingExtensionManager::HasAnyPolicyReinstallForCorruption() const { |
| 110 return !expected_policy_reinstalls_.empty(); |
| 111 } |
| 112 |
| 109 bool PendingExtensionManager::AddFromSync( | 113 bool PendingExtensionManager::AddFromSync( |
| 110 const std::string& id, | 114 const std::string& id, |
| 111 const GURL& update_url, | 115 const GURL& update_url, |
| 112 const base::Version& version, | 116 const base::Version& version, |
| 113 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, | 117 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, |
| 114 bool remote_install) { | 118 bool remote_install) { |
| 115 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 119 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 116 | 120 |
| 117 if (ExtensionRegistry::Get(context_)->GetExtensionById( | 121 if (ExtensionRegistry::Get(context_)->GetExtensionById( |
| 118 id, ExtensionRegistry::EVERYTHING)) { | 122 id, ExtensionRegistry::EVERYTHING)) { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 330 |
| 327 return true; | 331 return true; |
| 328 } | 332 } |
| 329 | 333 |
| 330 void PendingExtensionManager::AddForTesting( | 334 void PendingExtensionManager::AddForTesting( |
| 331 const PendingExtensionInfo& pending_extension_info) { | 335 const PendingExtensionInfo& pending_extension_info) { |
| 332 pending_extension_list_.push_back(pending_extension_info); | 336 pending_extension_list_.push_back(pending_extension_info); |
| 333 } | 337 } |
| 334 | 338 |
| 335 } // namespace extensions | 339 } // namespace extensions |
| OLD | NEW |