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

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

Issue 23258005: Give SxS distribution its own registration GUIDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed IsSetAsDefaultSupported() and GetCommandExecuteImplClsid(), and other minor cleanup. Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See the corresponding header file for description of the functions in this 5 // See the corresponding header file for description of the functions in this
6 // file. 6 // file.
7 7
8 #include "chrome/installer/util/install_util.h" 8 #include "chrome/installer/util/install_util.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 CHECK(command_line); 358 CHECK(command_line);
359 359
360 if (command_line->HasSwitch(installer::switches::kChromeSxS)) 360 if (command_line->HasSwitch(installer::switches::kChromeSxS))
361 return true; 361 return true;
362 362
363 // Also return true if we are running from Chrome SxS installed path. 363 // Also return true if we are running from Chrome SxS installed path.
364 base::FilePath exe_dir; 364 base::FilePath exe_dir;
365 PathService::Get(base::DIR_EXE, &exe_dir); 365 PathService::Get(base::DIR_EXE, &exe_dir);
366 string16 chrome_sxs_dir(installer::kGoogleChromeInstallSubDir2); 366 string16 chrome_sxs_dir(installer::kGoogleChromeInstallSubDir2);
367 chrome_sxs_dir.append(installer::kSxSSuffix); 367 chrome_sxs_dir.append(installer::kSxSSuffix);
368 return base::FilePath::CompareEqualIgnoreCase( 368
369 exe_dir.BaseName().value(), installer::kInstallBinaryDir) && 369 // This is SxS if current EXE is in or under (possibly multiple levels under)
370 base::FilePath::CompareEqualIgnoreCase( 370 // |chrome_sxs_dir|\|installer::kInstallBinaryDir|
371 exe_dir.DirName().BaseName().value(), chrome_sxs_dir); 371 std::vector<base::FilePath::StringType> components;
372 exe_dir.GetComponents(&components);
373 auto iter = components.rbegin();
grt (UTC plus 2) 2013/09/09 18:39:15 i don't believe auto is approved for use yet. plea
374 while (iter != components.rend()) {
375 auto next = iter+1;
376
377 if (base::FilePath::CompareEqualIgnoreCase(*iter,
378 installer::kInstallBinaryDir)) {
379
380 if (next != components.rend() &&
381 (base::FilePath::CompareEqualIgnoreCase(*next, chrome_sxs_dir)))
382 return true;
383 }
384
385 iter = next;
386 }
387
388 return false;
372 } 389 }
373 390
374 bool InstallUtil::IsChromeSxSProcess() { 391 bool InstallUtil::IsChromeSxSProcess() {
375 static bool sxs = CheckIsChromeSxSProcess(); 392 static bool sxs = CheckIsChromeSxSProcess();
376 return sxs; 393 return sxs;
377 } 394 }
378 395
379 bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file, 396 bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file,
380 BrowserDistribution* dist, 397 BrowserDistribution* dist,
381 base::FilePath* path) { 398 base::FilePath* path) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 // Open the program and see if it references the expected file. 620 // Open the program and see if it references the expected file.
604 base::win::ScopedHandle handle; 621 base::win::ScopedHandle handle;
605 BY_HANDLE_FILE_INFORMATION info = {}; 622 BY_HANDLE_FILE_INFORMATION info = {};
606 623
607 return (OpenForInfo(path, &handle) && 624 return (OpenForInfo(path, &handle) &&
608 GetInfo(handle, &info) && 625 GetInfo(handle, &info) &&
609 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && 626 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
610 info.nFileIndexHigh == file_info_.nFileIndexHigh && 627 info.nFileIndexHigh == file_info_.nFileIndexHigh &&
611 info.nFileIndexLow == file_info_.nFileIndexLow); 628 info.nFileIndexLow == file_info_.nFileIndexLow);
612 } 629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698