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

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

Issue 155187: ExtensionsServiceBackend::GarbageCollectionExtensions() makes a local copy of install_directory_ (Closed)
Patch Set: GarbageCollect makes local copy of install_directory_ Created 11 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions_service.h" 5 #include "chrome/browser/extensions/extensions_service.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/crypto/signature_verifier.h" 9 #include "base/crypto/signature_verifier.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 552 }
553 553
554 void ExtensionsServiceBackend::GarbageCollectExtensions( 554 void ExtensionsServiceBackend::GarbageCollectExtensions(
555 scoped_refptr<ExtensionsService> frontend) { 555 scoped_refptr<ExtensionsService> frontend) {
556 frontend_ = frontend; 556 frontend_ = frontend;
557 alert_on_error_ = false; 557 alert_on_error_ = false;
558 558
559 // Nothing to clean up if it doesn't exist. 559 // Nothing to clean up if it doesn't exist.
560 if (!file_util::DirectoryExists(install_directory_)) 560 if (!file_util::DirectoryExists(install_directory_))
561 return; 561 return;
562 562
563 file_util::AbsolutePath(&install_directory_); 563 FilePath install_directory_absolute(install_directory_);
564 file_util::AbsolutePath(&install_directory_absolute);
564 565
565 LOG(INFO) << "Loading installed extensions..."; 566 LOG(INFO) << "Loading installed extensions...";
566 567
567 // Find all child directories in the install directory and load their 568 // Find all child directories in the install directory and load their
568 // manifests. Post errors and results to the frontend. 569 // manifests. Post errors and results to the frontend.
569 file_util::FileEnumerator enumerator(install_directory_, 570 file_util::FileEnumerator enumerator(install_directory_absolute,
570 false, // Not recursive. 571 false, // Not recursive.
571 file_util::FileEnumerator::DIRECTORIES); 572 file_util::FileEnumerator::DIRECTORIES);
572 FilePath extension_path; 573 FilePath extension_path;
573 for (extension_path = enumerator.Next(); !extension_path.value().empty(); 574 for (extension_path = enumerator.Next(); !extension_path.value().empty();
574 extension_path = enumerator.Next()) { 575 extension_path = enumerator.Next()) {
575 std::string extension_id = WideToASCII( 576 std::string extension_id = WideToASCII(
576 extension_path.BaseName().ToWStringHack()); 577 extension_path.BaseName().ToWStringHack());
577 578
578 // The utility process might be in the middle of unpacking an extension, so 579 // The utility process might be in the middle of unpacking an extension, so
579 // ignore the temp unpacking directory. 580 // ignore the temp unpacking directory.
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 Extension::InstallType install_type = 1380 Extension::InstallType install_type =
1380 CompareToInstalledVersion(id, version->GetString(), &current_version); 1381 CompareToInstalledVersion(id, version->GetString(), &current_version);
1381 1382
1382 if (install_type == Extension::DOWNGRADE) 1383 if (install_type == Extension::DOWNGRADE)
1383 return false; 1384 return false;
1384 1385
1385 return (install_type == Extension::UPGRADE || 1386 return (install_type == Extension::UPGRADE ||
1386 install_type == Extension::NEW_INSTALL || 1387 install_type == Extension::NEW_INSTALL ||
1387 NeedsReinstall(id, current_version)); 1388 NeedsReinstall(id, current_version));
1388 } 1389 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698