Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / updater / extension_updater.cc
index 45f1ab8..14d9934 100644 (file)
@@ -102,16 +102,14 @@ ExtensionUpdater::FetchedCRXFile::FetchedCRXFile(
     const std::string& i,
     const base::FilePath& p,
     bool file_ownership_passed,
-    const GURL& u,
     const std::set<int>& request_ids)
     : extension_id(i),
       path(p),
       file_ownership_passed(file_ownership_passed),
-      download_url(u),
       request_ids(request_ids) {}
 
 ExtensionUpdater::FetchedCRXFile::FetchedCRXFile()
-    : path(), file_ownership_passed(true), download_url() {}
+    : path(), file_ownership_passed(true) {}
 
 ExtensionUpdater::FetchedCRXFile::~FetchedCRXFile() {}
 
@@ -193,12 +191,13 @@ TimeDelta ExtensionUpdater::DetermineFirstCheckDelay() {
                                           kStartupWaitSeconds * 8));
   }
 
-  // Read the persisted next check time, and use that if it isn't too soon.
-  // Otherwise pick something random.
+  // Read the persisted next check time, and use that if it isn't too soon
+  // or too late. Otherwise pick something random.
   Time saved_next = Time::FromInternalValue(prefs_->GetInt64(
       pref_names::kNextUpdateCheck));
   Time earliest = now + TimeDelta::FromSeconds(kStartupWaitSeconds);
-  if (saved_next >= earliest) {
+  Time latest = now + TimeDelta::FromSeconds(frequency_seconds_);
+  if (saved_next >= earliest && saved_next <= latest) {
     return saved_next - now;
   } else {
     return TimeDelta::FromSeconds(RandInt(kStartupWaitSeconds,
@@ -484,8 +483,7 @@ void ExtensionUpdater::OnExtensionDownloadFinished(
 
   VLOG(2) << download_url << " written to " << path.value();
 
-  FetchedCRXFile fetched(id, path, file_ownership_passed, download_url,
-                         request_ids);
+  FetchedCRXFile fetched(id, path, file_ownership_passed, request_ids);
   fetched_crx_files_.push(fetched);
 
   // MaybeInstallCRXFile() removes extensions from |in_progress_ids_| after
@@ -559,7 +557,6 @@ void ExtensionUpdater::MaybeInstallCRXFile() {
     if (service_->UpdateExtension(crx_file.extension_id,
                                   crx_file.path,
                                   crx_file.file_ownership_passed,
-                                  crx_file.download_url,
                                   &installer)) {
       crx_install_is_running_ = true;
       current_crx_file_ = crx_file;