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

Side by Side Diff: chrome/installer/util/package.cc

Issue 5429002: Support for checking multiple keyfiles when removing an installation package.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/installer/util/package.h" 5 #include "chrome/installer/util/package.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/win/registry.h" 9 #include "base/win/registry.h"
10 #include "chrome/installer/util/delete_tree_work_item.h" 10 #include "chrome/installer/util/delete_tree_work_item.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // We try to delete all directories whose versions are lower than 118 // We try to delete all directories whose versions are lower than
119 // latest_version. 119 // latest_version.
120 while (ret) { 120 while (ret) {
121 if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && 121 if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
122 lstrcmpW(find_file_data.cFileName, L"..") != 0 && 122 lstrcmpW(find_file_data.cFileName, L"..") != 0 &&
123 lstrcmpW(find_file_data.cFileName, L".") != 0) { 123 lstrcmpW(find_file_data.cFileName, L".") != 0) {
124 VLOG(1) << "directory found: " << find_file_data.cFileName; 124 VLOG(1) << "directory found: " << find_file_data.cFileName;
125 version.reset(Version::GetVersionFromString(find_file_data.cFileName)); 125 version.reset(Version::GetVersionFromString(find_file_data.cFileName));
126 if (version.get() && latest_version.IsHigherThan(version.get())) { 126 if (version.get() && latest_version.IsHigherThan(version.get())) {
127 std::wstring remove_dir(path_.value()); 127 FilePath remove_dir(path_.Append(find_file_data.cFileName));
128 file_util::AppendToPath(&remove_dir, find_file_data.cFileName); 128 std::vector<FilePath> key_files;
129 std::wstring chrome_dll_path(remove_dir); 129 Products::const_iterator it = products_.begin();
130 file_util::AppendToPath(&chrome_dll_path, installer_util::kChromeDll); 130 for (; it != products_.end(); ++it) {
131 VLOG(1) << "Deleting directory: " << remove_dir; 131 BrowserDistribution* dist = it->get()->distribution();
132 // TODO(tommi): We should support more "key files". One for each 132 key_files.push_back(remove_dir.Append(dist->GetKeyFile()));
133 // associated Product. Maybe the relative key file path should 133 }
134 // be a property of BrowserDistribution. 134
135 VLOG(1) << "Deleting directory: " << remove_dir.value();
136
135 scoped_ptr<DeleteTreeWorkItem> item( 137 scoped_ptr<DeleteTreeWorkItem> item(
136 WorkItem::CreateDeleteTreeWorkItem(remove_dir, chrome_dll_path)); 138 WorkItem::CreateDeleteTreeWorkItem(remove_dir, key_files));
137 if (!item->Do()) 139 if (!item->Do())
138 item->Rollback(); 140 item->Rollback();
139 } 141 }
140 } 142 }
141 ret = FindNextFile(file_handle, &find_file_data); 143 ret = FindNextFile(file_handle, &find_file_data);
142 } 144 }
143 145
144 FindClose(file_handle); 146 FindClose(file_handle);
145 } 147 }
146 148
147 } // namespace installer 149 } // namespace installer
148 150
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_tree_work_item_unittest.cc ('k') | chrome/installer/util/work_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698