Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Unified Diff: chrome/browser/extensions/extension_updater.cc

Issue 1695018: Adding ExtensionPrefs methods for storing update-when-idle data.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_updater.cc
===================================================================
--- chrome/browser/extensions/extension_updater.cc (revision 45592)
+++ chrome/browser/extensions/extension_updater.cc (working copy)
@@ -258,7 +258,8 @@
fetches_.find(update_url);
// Find or create a ManifestFetchData to add this extension to.
- int ping_days = CalculatePingDays(service_->LastPingDay(id));
+ int ping_days =
+ CalculatePingDays(service_->extension_prefs()->LastPingDay(id));
while (existing_iter != fetches_.end()) {
if (existing_iter->second->AddExtension(id, version.GetString(),
ping_days)) {
@@ -300,8 +301,7 @@
return;
}
- // The ExtensionUpdater is now responsible for cleaning up the temp file
- // from disk.
+ // The ExtensionUpdater now owns the temp file.
ChromeThread::PostTask(
ChromeThread::UI, FROM_HERE,
NewRunnableMethod(
@@ -309,13 +309,6 @@
path, download_url));
}
- void DeleteFile(const FilePath& path) {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
- if (!file_util::Delete(path, false)) {
- LOG(WARNING) << "Failed to delete temp file " << path.value();
- }
- }
-
private:
friend class base::RefCountedThreadSafe<ExtensionUpdaterFileHandler>;
@@ -554,9 +547,9 @@
bool did_ping = fetch_data.DidPing(*i);
if (did_ping) {
if (*i == kBlacklistAppID) {
- service_->SetBlacklistLastPingDay(daystart);
+ service_->extension_prefs()->SetBlacklistLastPingDay(daystart);
} else if (service_->GetExtensionById(*i, true) != NULL) {
- service_->SetLastPingDay(*i, daystart);
+ service_->extension_prefs()->SetLastPingDay(*i, daystart);
}
}
}
@@ -592,7 +585,7 @@
int response_code,
const std::string& data) {
if (status.status() == URLRequestStatus::SUCCESS &&
- response_code == 200) {
+ response_code == 200) {
if (current_extension_fetch_.id == kBlacklistAppID) {
ProcessBlacklist(data);
} else {
@@ -626,17 +619,11 @@
void ExtensionUpdater::OnCRXFileWritten(const std::string& id,
const FilePath& path,
const GURL& download_url) {
+ // The ExtensionsService is now responsible for cleaning up the temp file
+ // at |path|.
service_->UpdateExtension(id, path, download_url);
}
-void ExtensionUpdater::OnExtensionInstallFinished(const FilePath& path,
- Extension* extension) {
- // Have the file_handler_ delete the temp file on the file I/O thread.
- ChromeThread::PostTask(
- ChromeThread::FILE, FROM_HERE,
- NewRunnableMethod(
- file_handler_.get(), &ExtensionUpdaterFileHandler::DeleteFile, path));
-}
void ExtensionUpdater::ScheduleNextCheck(const TimeDelta& target_delay) {
DCHECK(!timer_.IsRunning());
@@ -706,7 +693,8 @@
ManifestFetchData* blacklist_fetch =
new ManifestFetchData(GURL(kBlacklistUpdateUrl));
std::wstring version = prefs_->GetString(kExtensionBlacklistUpdateVersion);
- int ping_days = CalculatePingDays(service_->BlacklistLastPingDay());
+ int ping_days =
+ CalculatePingDays(service_->extension_prefs()->BlacklistLastPingDay());
blacklist_fetch->AddExtension(kBlacklistAppID, WideToASCII(version),
ping_days);
StartUpdateCheck(blacklist_fetch);
« no previous file with comments | « chrome/browser/extensions/extension_updater.h ('k') | chrome/browser/extensions/extension_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698