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

Side by Side Diff: extensions/browser/updater/update_install_shim.cc

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/browser/updater/update_install_shim.h" 5 #include "extensions/browser/updater/update_install_shim.h"
6 6
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/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 bool UpdateInstallShim::Install(const base::DictionaryValue& manifest, 29 bool UpdateInstallShim::Install(const base::DictionaryValue& manifest,
30 const base::FilePath& unpack_path) { 30 const base::FilePath& unpack_path) {
31 base::ScopedTempDir temp_dir; 31 base::ScopedTempDir temp_dir;
32 if (!temp_dir.CreateUniqueTempDir()) 32 if (!temp_dir.CreateUniqueTempDir())
33 return false; 33 return false;
34 34
35 // The UpdateClient code will delete unpack_path if it still exists after 35 // The UpdateClient code will delete unpack_path if it still exists after
36 // this method is done, so we rename it on top of our temp dir. 36 // this method is done, so we rename it on top of our temp dir.
37 if (!base::DeleteFile(temp_dir.path(), true) || 37 if (!base::DeleteFile(temp_dir.GetPath(), true) ||
38 !base::Move(unpack_path, temp_dir.path())) { 38 !base::Move(unpack_path, temp_dir.GetPath())) {
39 LOG(ERROR) << "Trying to install update for " << extension_id_ 39 LOG(ERROR) << "Trying to install update for " << extension_id_
40 << "and failed to move " << unpack_path.value() << " to " 40 << "and failed to move " << unpack_path.value() << " to "
41 << temp_dir.path().value(); 41 << temp_dir.GetPath().value();
42 return false; 42 return false;
43 } 43 }
44 content::BrowserThread::PostTask( 44 content::BrowserThread::PostTask(
45 content::BrowserThread::UI, FROM_HERE, 45 content::BrowserThread::UI, FROM_HERE,
46 base::Bind(&UpdateInstallShim::RunCallbackOnUIThread, this, 46 base::Bind(&UpdateInstallShim::RunCallbackOnUIThread, this,
47 temp_dir.Take())); 47 temp_dir.Take()));
48 return true; 48 return true;
49 } 49 }
50 50
51 bool UpdateInstallShim::GetInstalledFile(const std::string& file, 51 bool UpdateInstallShim::GetInstalledFile(const std::string& file,
(...skipping 22 matching lines...) Expand all
74 if (callback_.is_null()) { 74 if (callback_.is_null()) {
75 content::BrowserThread::PostBlockingPoolTask( 75 content::BrowserThread::PostBlockingPoolTask(
76 FROM_HERE, base::Bind(base::IgnoreResult(&base::DeleteFile), temp_dir, 76 FROM_HERE, base::Bind(base::IgnoreResult(&base::DeleteFile), temp_dir,
77 true /*recursive */)); 77 true /*recursive */));
78 return; 78 return;
79 } 79 }
80 callback_.Run(extension_id_, temp_dir); 80 callback_.Run(extension_id_, temp_dir);
81 } 81 }
82 82
83 } // namespace extensions 83 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/sandboxed_unpacker_unittest.cc ('k') | extensions/browser/updater/update_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698