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 20 matching lines...) Expand all Loading... | |
31 #include "chrome/installer/util/installation_state.h" | 31 #include "chrome/installer/util/installation_state.h" |
32 #include "chrome/installer/util/l10n_string_util.h" | 32 #include "chrome/installer/util/l10n_string_util.h" |
33 #include "chrome/installer/util/util_constants.h" | 33 #include "chrome/installer/util/util_constants.h" |
34 #include "chrome/installer/util/work_item_list.h" | 34 #include "chrome/installer/util/work_item_list.h" |
35 | 35 |
36 using base::win::RegKey; | 36 using base::win::RegKey; |
37 using installer::ProductState; | 37 using installer::ProductState; |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 const wchar_t* kExperimentAppGuids[] = { | |
42 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}", | |
grt (UTC plus 2)
2012/11/20 16:05:46
this is the binaries' app guid. what does it have
SteveT
2012/11/20 23:23:50
To be honest, I do not know why this is here. I ca
grt (UTC plus 2)
2012/11/21 20:14:18
sgtm
| |
43 L"{8A69D345-D564-463C-AFF1-A69D9E530F96}", | |
grt (UTC plus 2)
2012/11/20 16:05:46
this is Chrome's app guid.
SteveT
2012/11/20 23:23:50
Yes, and when I am done refactoring this code and
| |
44 }; | |
45 | |
46 const wchar_t kExperimentLabels[] = L"experiment_labels"; | |
47 | |
41 const wchar_t kStageBinaryPatching[] = L"binary_patching"; | 48 const wchar_t kStageBinaryPatching[] = L"binary_patching"; |
42 const wchar_t kStageBuilding[] = L"building"; | 49 const wchar_t kStageBuilding[] = L"building"; |
43 const wchar_t kStageConfiguringAutoLaunch[] = L"configuring_auto_launch"; | 50 const wchar_t kStageConfiguringAutoLaunch[] = L"configuring_auto_launch"; |
44 const wchar_t kStageCopyingPreferencesFile[] = L"copying_prefs"; | 51 const wchar_t kStageCopyingPreferencesFile[] = L"copying_prefs"; |
45 const wchar_t kStageCreatingShortcuts[] = L"creating_shortcuts"; | 52 const wchar_t kStageCreatingShortcuts[] = L"creating_shortcuts"; |
46 const wchar_t kStageEnsemblePatching[] = L"ensemble_patching"; | 53 const wchar_t kStageEnsemblePatching[] = L"ensemble_patching"; |
47 const wchar_t kStageExecuting[] = L"executing"; | 54 const wchar_t kStageExecuting[] = L"executing"; |
48 const wchar_t kStageFinishing[] = L"finishing"; | 55 const wchar_t kStageFinishing[] = L"finishing"; |
49 const wchar_t kStagePreconditions[] = L"preconditions"; | 56 const wchar_t kStagePreconditions[] = L"preconditions"; |
50 const wchar_t kStageRefreshingPolicy[] = L"refreshing_policy"; | 57 const wchar_t kStageRefreshingPolicy[] = L"refreshing_policy"; |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 date_str, arraysize(date_str)); | 523 date_str, arraysize(date_str)); |
517 if (len) { | 524 if (len) { |
518 --len; // Subtract terminating \0. | 525 --len; // Subtract terminating \0. |
519 } else { | 526 } else { |
520 PLOG(DFATAL) << "GetDateFormat"; | 527 PLOG(DFATAL) << "GetDateFormat"; |
521 } | 528 } |
522 | 529 |
523 return string16(date_str, len); | 530 return string16(date_str, len); |
524 } | 531 } |
525 | 532 |
533 // static | |
534 bool InstallUtil::SetOmahaExperimentLabel(const string16& experiment_label, | |
grt (UTC plus 2)
2012/11/20 16:05:46
this should only exist and/or do anything useful f
SteveT
2012/11/20 23:23:50
Google Chrome and gcapi builds, from what I unders
grt (UTC plus 2)
2012/11/21 20:14:18
I think the contents of this should likely be ifde
SteveT
2012/11/21 23:19:26
Well we want this to run in the GCAPI DLL... is th
| |
535 HKEY registry_hive) { | |
536 int successful_writes = 0; | |
537 for (int i = 0; i < arraysize(kExperimentAppGuids); ++i) { | |
grt (UTC plus 2)
2012/11/20 16:05:46
int -> size_t (arraysize returns a size_t) here an
SteveT
2012/11/20 23:23:50
Done.
| |
538 string16 experiment_path(google_update::kRegPathClientState); | |
grt (UTC plus 2)
2012/11/20 16:05:46
move this instance out of the loop and just assign
SteveT
2012/11/20 23:23:50
Done.
| |
539 experiment_path += L"\\"; | |
540 experiment_path += kExperimentAppGuids[i]; | |
541 | |
542 RegKey client_state(registry_hive, experiment_path.c_str(), | |
grt (UTC plus 2)
2012/11/20 16:05:46
this will create the key if it doesn't exist. is
SteveT
2012/11/20 23:23:50
Yes, I believe that is the case. In fact, this who
grt (UTC plus 2)
2012/11/21 20:14:18
Fortunately, this is not the case. If it were, thi
SteveT
2012/11/21 23:19:26
This is meant to be a dumb "write to (and over) th
SteveT
2012/11/21 23:19:26
Sorry, when I said clobbers the Key, I meant it cl
| |
543 KEY_SET_VALUE); | |
544 if (client_state.Valid() && | |
grt (UTC plus 2)
2012/11/20 16:05:46
this check isn't needed
SteveT
2012/11/20 23:23:50
Done.
| |
545 client_state.WriteValue(kExperimentLabels, | |
546 experiment_label.c_str()) == ERROR_SUCCESS) { | |
547 successful_writes++; | |
grt (UTC plus 2)
2012/11/20 16:05:46
prefer preincrement
SteveT
2012/11/20 23:23:50
Done.
| |
548 } | |
549 } | |
550 | |
551 return (successful_writes == arraysize(kExperimentAppGuids)); | |
552 } | |
553 | |
526 // Open |path| with minimal access to obtain information about it, returning | 554 // Open |path| with minimal access to obtain information about it, returning |
527 // true and populating |handle| on success. | 555 // true and populating |handle| on success. |
528 // static | 556 // static |
529 bool InstallUtil::ProgramCompare::OpenForInfo(const FilePath& path, | 557 bool InstallUtil::ProgramCompare::OpenForInfo(const FilePath& path, |
530 base::win::ScopedHandle* handle) { | 558 base::win::ScopedHandle* handle) { |
531 DCHECK(handle); | 559 DCHECK(handle); |
532 handle->Set(base::CreatePlatformFile(path, base::PLATFORM_FILE_OPEN, NULL, | 560 handle->Set(base::CreatePlatformFile(path, base::PLATFORM_FILE_OPEN, NULL, |
533 NULL)); | 561 NULL)); |
534 return handle->IsValid(); | 562 return handle->IsValid(); |
535 } | 563 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 // Open the program and see if it references the expected file. | 613 // Open the program and see if it references the expected file. |
586 base::win::ScopedHandle handle; | 614 base::win::ScopedHandle handle; |
587 BY_HANDLE_FILE_INFORMATION info = {}; | 615 BY_HANDLE_FILE_INFORMATION info = {}; |
588 | 616 |
589 return (OpenForInfo(program, &handle) && | 617 return (OpenForInfo(program, &handle) && |
590 GetInfo(handle, &info) && | 618 GetInfo(handle, &info) && |
591 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 619 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
592 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 620 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
593 info.nFileIndexLow == file_info_.nFileIndexLow); | 621 info.nFileIndexLow == file_info_.nFileIndexLow); |
594 } | 622 } |
OLD | NEW |