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

Side by Side Diff: chrome/browser/extensions/extension_updater.cc

Issue 160311: Pull CrxInstaller out of ExtensionsService. (Closed)
Patch Set: Fix leak of SandboxedExtensionUnpacker Created 11 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/logging.h" 10 #include "base/logging.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // If there are any pending downloads left, start one. 202 // If there are any pending downloads left, start one.
203 if (extensions_pending_.size() > 0) { 203 if (extensions_pending_.size() > 0) {
204 ExtensionFetch next = extensions_pending_.front(); 204 ExtensionFetch next = extensions_pending_.front();
205 extensions_pending_.pop_front(); 205 extensions_pending_.pop_front();
206 FetchUpdatedExtension(next.id, next.url); 206 FetchUpdatedExtension(next.id, next.url);
207 } 207 }
208 } 208 }
209 209
210 void ExtensionUpdater::OnCRXFileWritten(const std::string& id, 210 void ExtensionUpdater::OnCRXFileWritten(const std::string& id,
211 const FilePath& path) { 211 const FilePath& path) {
212 // TODO(asargent) - Instead of calling InstallExtension here, we should have 212 service_->UpdateExtension(id, path);
213 // an UpdateExtension method in ExtensionsService and rely on it to check
214 // that the extension is still installed, and still an older version than
215 // what we're handing it.
216 // (http://crbug.com/12764).
217 ExtensionInstallCallback* callback =
218 NewCallback(this, &ExtensionUpdater::OnExtensionInstallFinished);
219 service_->UpdateExtension(id, path, false, callback);
220 } 213 }
221 214
222 void ExtensionUpdater::OnExtensionInstallFinished(const FilePath& path, 215 void ExtensionUpdater::OnExtensionInstallFinished(const FilePath& path,
223 Extension* extension) { 216 Extension* extension) {
224 // Have the file_handler_ delete the temp file on the file I/O thread. 217 // Have the file_handler_ delete the temp file on the file I/O thread.
225 file_io_loop_->PostTask(FROM_HERE, NewRunnableMethod( 218 file_io_loop_->PostTask(FROM_HERE, NewRunnableMethod(
226 file_handler_.get(), &ExtensionUpdaterFileHandler::DeleteFile, path)); 219 file_handler_.get(), &ExtensionUpdaterFileHandler::DeleteFile, path));
227 } 220 }
228 221
229 222
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 571 }
579 } else { 572 } else {
580 extension_fetcher_.reset( 573 extension_fetcher_.reset(
581 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); 574 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this));
582 extension_fetcher_->set_request_context( 575 extension_fetcher_->set_request_context(
583 Profile::GetDefaultRequestContext()); 576 Profile::GetDefaultRequestContext());
584 extension_fetcher_->Start(); 577 extension_fetcher_->Start();
585 current_extension_fetch_ = ExtensionFetch(id, url); 578 current_extension_fetch_ = ExtensionFetch(id, url);
586 } 579 }
587 } 580 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/extension_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698