OLD | NEW |
---|---|
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 21 matching lines...) Expand all Loading... | |
32 #include "chrome/installer/util/installation_state.h" | 32 #include "chrome/installer/util/installation_state.h" |
33 #include "chrome/installer/util/l10n_string_util.h" | 33 #include "chrome/installer/util/l10n_string_util.h" |
34 #include "chrome/installer/util/util_constants.h" | 34 #include "chrome/installer/util/util_constants.h" |
35 #include "chrome/installer/util/work_item_list.h" | 35 #include "chrome/installer/util/work_item_list.h" |
36 | 36 |
37 using base::win::RegKey; | 37 using base::win::RegKey; |
38 using installer::ProductState; | 38 using installer::ProductState; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 const wchar_t kExperimentLabels[] = L"experiment_labels"; | |
grt (UTC plus 2)
2012/11/24 02:58:37
Since this is a value defined by Omaha, please mov
SteveT
2012/11/26 20:45:06
Done.
| |
43 | |
42 const wchar_t kStageBinaryPatching[] = L"binary_patching"; | 44 const wchar_t kStageBinaryPatching[] = L"binary_patching"; |
43 const wchar_t kStageBuilding[] = L"building"; | 45 const wchar_t kStageBuilding[] = L"building"; |
44 const wchar_t kStageConfiguringAutoLaunch[] = L"configuring_auto_launch"; | 46 const wchar_t kStageConfiguringAutoLaunch[] = L"configuring_auto_launch"; |
45 const wchar_t kStageCopyingPreferencesFile[] = L"copying_prefs"; | 47 const wchar_t kStageCopyingPreferencesFile[] = L"copying_prefs"; |
46 const wchar_t kStageCreatingShortcuts[] = L"creating_shortcuts"; | 48 const wchar_t kStageCreatingShortcuts[] = L"creating_shortcuts"; |
47 const wchar_t kStageEnsemblePatching[] = L"ensemble_patching"; | 49 const wchar_t kStageEnsemblePatching[] = L"ensemble_patching"; |
48 const wchar_t kStageExecuting[] = L"executing"; | 50 const wchar_t kStageExecuting[] = L"executing"; |
49 const wchar_t kStageFinishing[] = L"finishing"; | 51 const wchar_t kStageFinishing[] = L"finishing"; |
50 const wchar_t kStagePreconditions[] = L"preconditions"; | 52 const wchar_t kStagePreconditions[] = L"preconditions"; |
51 const wchar_t kStageRefreshingPolicy[] = L"refreshing_policy"; | 53 const wchar_t kStageRefreshingPolicy[] = L"refreshing_policy"; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 date_str, arraysize(date_str)); | 514 date_str, arraysize(date_str)); |
513 if (len) { | 515 if (len) { |
514 --len; // Subtract terminating \0. | 516 --len; // Subtract terminating \0. |
515 } else { | 517 } else { |
516 PLOG(DFATAL) << "GetDateFormat"; | 518 PLOG(DFATAL) << "GetDateFormat"; |
517 } | 519 } |
518 | 520 |
519 return string16(date_str, len); | 521 return string16(date_str, len); |
520 } | 522 } |
521 | 523 |
524 // static | |
525 bool InstallUtil::SetOmahaExperimentLabel(const string16& experiment_label, | |
grt (UTC plus 2)
2012/11/24 02:58:37
Upon further consideration, I think this belongs i
grt (UTC plus 2)
2012/11/24 03:03:44
Also, please add a test case to google_update_sett
SteveT
2012/11/26 20:45:06
Moved it.
SteveT
2012/11/26 20:45:06
Currently trying to understand the tests in google
| |
526 bool system_install) { | |
527 HKEY registry_hive = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | |
grt (UTC plus 2)
2012/11/24 02:58:37
nit: other code in the installer uses either the n
SteveT
2012/11/26 20:45:06
Done.
| |
528 | |
529 // Use the browser distribution and install level to write to the correct | |
530 // client state/app guid key. | |
531 bool success = false; | |
532 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
533 if (dist->ShouldWriteExperimentLabels()) { | |
534 string16 client_state_path( | |
535 system_install ? dist->GetStateMediumKey() : dist->GetStateKey()); | |
536 RegKey client_state( | |
537 registry_hive, client_state_path.c_str(), KEY_SET_VALUE); | |
538 success = client_state.WriteValue(kExperimentLabels, | |
grt (UTC plus 2)
2012/11/24 03:03:44
It looks like Omaha deletes the value in the regis
SteveT
2012/11/26 20:45:06
Okay, done. The return value will also represent t
| |
539 experiment_label.c_str()) == ERROR_SUCCESS; | |
540 } | |
541 | |
542 return success; | |
543 } | |
544 | |
522 // Open |path| with minimal access to obtain information about it, returning | 545 // Open |path| with minimal access to obtain information about it, returning |
523 // true and populating |handle| on success. | 546 // true and populating |handle| on success. |
524 // static | 547 // static |
525 bool InstallUtil::ProgramCompare::OpenForInfo(const FilePath& path, | 548 bool InstallUtil::ProgramCompare::OpenForInfo(const FilePath& path, |
526 base::win::ScopedHandle* handle) { | 549 base::win::ScopedHandle* handle) { |
527 DCHECK(handle); | 550 DCHECK(handle); |
528 handle->Set(base::CreatePlatformFile(path, base::PLATFORM_FILE_OPEN, NULL, | 551 handle->Set(base::CreatePlatformFile(path, base::PLATFORM_FILE_OPEN, NULL, |
529 NULL)); | 552 NULL)); |
530 return handle->IsValid(); | 553 return handle->IsValid(); |
531 } | 554 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 // Open the program and see if it references the expected file. | 604 // Open the program and see if it references the expected file. |
582 base::win::ScopedHandle handle; | 605 base::win::ScopedHandle handle; |
583 BY_HANDLE_FILE_INFORMATION info = {}; | 606 BY_HANDLE_FILE_INFORMATION info = {}; |
584 | 607 |
585 return (OpenForInfo(program, &handle) && | 608 return (OpenForInfo(program, &handle) && |
586 GetInfo(handle, &info) && | 609 GetInfo(handle, &info) && |
587 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 610 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
588 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 611 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
589 info.nFileIndexLow == file_info_.nFileIndexLow); | 612 info.nFileIndexLow == file_info_.nFileIndexLow); |
590 } | 613 } |
OLD | NEW |