#include <set>
#include "base/bind.h"
-#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/pending_extension_manager.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/pref_names.h"
#include "components/omaha_query_params/omaha_query_params.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
+#include "extensions/common/manifest_constants.h"
using base::RandDouble;
using base::RandInt;
extensions::kPlatformSpecificFolder);
if (base::PathExists(platform_specific_path)) {
bool force = true;
- base::FileEnumerator all_archs(platform_specific_path,
- false,
- base::FileEnumerator::DIRECTORIES);
- base::FilePath arch;
- while (!(arch = all_archs.Next()).empty()) {
- std::string arch_name = arch.BaseName().AsUTF8Unsafe();
- std::replace(arch_name.begin(), arch_name.end(), '_', '-');
- if (arch_name == OmahaQueryParams::GetNaclArch())
- force = false;
+ const base::ListValue* platforms;
+ if (extension->manifest()->GetList(extensions::manifest_keys::kPlatforms,
+ &platforms)) {
+ for (size_t i = 0; i < platforms->GetSize(); ++i) {
+ const base::DictionaryValue* p;
+ if (platforms->GetDictionary(i, &p)) {
+ std::string nacl_arch;
+ if (p->GetString(extensions::manifest_keys::kNaClArch,
+ &nacl_arch) &&
+ nacl_arch == OmahaQueryParams::GetNaclArch()) {
+ std::string subpath;
+ if (p->GetString(extensions::manifest_keys::kSubPackagePath,
+ &subpath)) {
+ // _platform_specific is part of the sub_package_path entry.
+ base::FilePath platform_specific_subpath =
+ extension->path().AppendASCII(subpath);
+ if (base::PathExists(platform_specific_subpath)) {
+ force = false;
+ }
+ }
+ }
+ }
+ }
}
if (force)
ExtensionCache* cache,
const ExtensionDownloader::Factory& downloader_factory)
: alive_(false),
- weak_ptr_factory_(this),
service_(service),
downloader_factory_(downloader_factory),
frequency_seconds_(frequency_seconds),
next_request_id_(0),
extension_registry_observer_(this),
crx_install_is_running_(false),
- extension_cache_(cache) {
+ extension_cache_(cache),
+ weak_ptr_factory_(this) {
DCHECK_GE(frequency_seconds_, 5);
DCHECK_LE(frequency_seconds_, kMaxUpdateFrequencySeconds);
#if defined(NDEBUG)
return will_check_soon_;
}
+void ExtensionUpdater::SetExtensionCacheForTesting(
+ ExtensionCache* extension_cache) {
+ extension_cache_ = extension_cache;
+}
+
void ExtensionUpdater::DoCheckSoon() {
DCHECK(will_check_soon_);
CheckNow(default_params_);
ping_data->rollcall_days = CalculatePingDays(
extension_prefs_->LastPingDay(id));
ping_data->is_enabled = service_->IsExtensionEnabled(id);
+ if (!ping_data->is_enabled)
+ ping_data->disable_reasons = extension_prefs_->GetDisableReasons(id);
ping_data->active_days =
CalculateActivePingDays(extension_prefs_->LastActivePingDay(id),
extension_prefs_->GetActiveBit(id));