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

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

Issue 27215: Fix a memory leak in extension install. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/scoped_handle.h" 8 #include "base/scoped_handle.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 void ExtensionsServiceBackend::ReportExtensionInstalled( 710 void ExtensionsServiceBackend::ReportExtensionInstalled(
711 FilePath path, bool update) { 711 FilePath path, bool update) {
712 frontend_->GetMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod( 712 frontend_->GetMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod(
713 frontend_, 713 frontend_,
714 &ExtensionsServiceFrontendInterface::OnExtensionInstalled, 714 &ExtensionsServiceFrontendInterface::OnExtensionInstalled,
715 path, 715 path,
716 update)); 716 update));
717 717
718 // After it's installed, load it right away with the same settings. 718 // After it's installed, load it right away with the same settings.
719 extension_path_ = path; 719 extension_path_ = path;
720 LoadExtensionCurrentVersion(); 720 LOG(INFO) << "Loading extension " << path.value();
721 Extension* extension = LoadExtensionCurrentVersion();
722 if (extension) {
723 // Only one extension, but ReportExtensionsLoaded can handle multiple,
724 // so we need to construct a list.
725 scoped_ptr<ExtensionList> extensions(new ExtensionList);
726 extensions->push_back(extension);
727 LOG(INFO) << "Done.";
728 // Hand off ownership of the loaded extensions to the frontend.
729 ReportExtensionsLoaded(extensions.release());
730 }
721 } 731 }
722 732
723 // Some extensions will autoupdate themselves externally from Chrome. These 733 // Some extensions will autoupdate themselves externally from Chrome. These
724 // are typically part of some larger client application package. To support 734 // are typically part of some larger client application package. To support
725 // these, the extension will register its location in the registry on Windows 735 // these, the extension will register its location in the registry on Windows
726 // (TODO(port): what about on other platforms?) and this code will periodically 736 // (TODO(port): what about on other platforms?) and this code will periodically
727 // check that location for a .crx file, which it will then install locally if 737 // check that location for a .crx file, which it will then install locally if
728 // a new version is available. 738 // a new version is available.
729 void ExtensionsServiceBackend::CheckForExternalUpdates( 739 void ExtensionsServiceBackend::CheckForExternalUpdates(
730 const FilePath& install_dir, 740 const FilePath& install_dir,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 825
816 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id, 826 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id,
817 const std::string& version) { 827 const std::string& version) {
818 FilePath dir(install_directory_.AppendASCII(id.c_str())); 828 FilePath dir(install_directory_.AppendASCII(id.c_str()));
819 std::string current_version; 829 std::string current_version;
820 if (ReadCurrentVersion(dir, &current_version)) { 830 if (ReadCurrentVersion(dir, &current_version)) {
821 return !CheckCurrentVersion(version, current_version, dir); 831 return !CheckCurrentVersion(version, current_version, dir);
822 } 832 }
823 return true; 833 return true;
824 } 834 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698