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

Side by Side Diff: components/component_updater/default_component_installer.cc

Issue 1280673002: Avoiding creation of new string for component version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return false; 77 return false;
78 if (!installer_traits_->VerifyInstallation(manifest, install_path)) 78 if (!installer_traits_->VerifyInstallation(manifest, install_path))
79 return false; 79 return false;
80 return true; 80 return true;
81 } 81 }
82 82
83 bool DefaultComponentInstaller::Install(const base::DictionaryValue& manifest, 83 bool DefaultComponentInstaller::Install(const base::DictionaryValue& manifest,
84 const base::FilePath& unpack_path) { 84 const base::FilePath& unpack_path) {
85 std::string manifest_version; 85 std::string manifest_version;
86 manifest.GetStringASCII("version", &manifest_version); 86 manifest.GetStringASCII("version", &manifest_version);
87 base::Version version(manifest_version.c_str()); 87 base::Version version(manifest_version);
88 if (!version.IsValid()) 88 if (!version.IsValid())
89 return false; 89 return false;
90 if (current_version_.CompareTo(version) > 0) 90 if (current_version_.CompareTo(version) > 0)
91 return false; 91 return false;
92 base::FilePath install_path = 92 base::FilePath install_path =
93 installer_traits_->GetBaseDirectory().AppendASCII(version.GetString()); 93 installer_traits_->GetBaseDirectory().AppendASCII(version.GetString());
94 if (base::PathExists(install_path)) { 94 if (base::PathExists(install_path)) {
95 if (!base::DeleteFile(install_path, true)) 95 if (!base::DeleteFile(install_path, true))
96 return false; 96 return false;
97 } 97 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 ComponentReady(manifest_copy.Pass()); 265 ComponentReady(manifest_copy.Pass());
266 } 266 }
267 267
268 void DefaultComponentInstaller::ComponentReady( 268 void DefaultComponentInstaller::ComponentReady(
269 scoped_ptr<base::DictionaryValue> manifest) { 269 scoped_ptr<base::DictionaryValue> manifest) {
270 installer_traits_->ComponentReady( 270 installer_traits_->ComponentReady(
271 current_version_, GetInstallDirectory(), manifest.Pass()); 271 current_version_, GetInstallDirectory(), manifest.Pass());
272 } 272 }
273 273
274 } // namespace component_updater 274 } // namespace component_updater
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