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 #include "chrome/installer/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 539 |
540 if (value->SetMultiFailSuffix(false)) { | 540 if (value->SetMultiFailSuffix(false)) { |
541 VLOG(1) << "Removed multi-install failure key; switching to channel: " | 541 VLOG(1) << "Removed multi-install failure key; switching to channel: " |
542 << value->value(); | 542 << value->value(); |
543 modified = true; | 543 modified = true; |
544 } | 544 } |
545 | 545 |
546 return modified; | 546 return modified; |
547 } | 547 } |
548 | 548 |
549 void GoogleUpdateSettings::UpdateProfileCounts(int profiles_active, | 549 void GoogleUpdateSettings::UpdateProfileCounts(size_t profiles_active, |
550 int profiles_signedin) { | 550 size_t profiles_signedin) { |
551 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 551 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
552 // System-level installs must write into the ClientStateMedium key shared by | 552 // System-level installs must write into the ClientStateMedium key shared by |
553 // all users. Special treatment is used to aggregate across those users. | 553 // all users. Special treatment is used to aggregate across those users. |
554 if (IsSystemInstall()) { | 554 if (IsSystemInstall()) { |
555 // Write the counts as ints that get aggregated across all users via | 555 // Write the counts as ints that get aggregated across all users via |
556 // summation for system-level installs. | 556 // summation for system-level installs. |
557 WriteGoogleUpdateAggregateNumKeyInternal( | 557 WriteGoogleUpdateAggregateNumKeyInternal( |
558 dist->GetAppRegistrationData(), | 558 dist->GetAppRegistrationData(), |
559 google_update::kRegProfilesActive, | 559 google_update::kRegProfilesActive, |
560 profiles_active, | 560 profiles_active, |
561 L"sum()"); | 561 L"sum()"); |
562 WriteGoogleUpdateAggregateNumKeyInternal( | 562 WriteGoogleUpdateAggregateNumKeyInternal( |
563 dist->GetAppRegistrationData(), | 563 dist->GetAppRegistrationData(), |
564 google_update::kRegProfilesSignedIn, | 564 google_update::kRegProfilesSignedIn, |
565 profiles_signedin, | 565 profiles_signedin, |
566 L"sum()"); | 566 L"sum()"); |
567 } else { | 567 } else { |
568 // Write the counts as strings since no aggregation function is needed for | 568 // Write the counts as strings since no aggregation function is needed for |
569 // user-level installs. | 569 // user-level installs. |
570 WriteGoogleUpdateStrKeyInternal(dist->GetAppRegistrationData(), | 570 WriteGoogleUpdateStrKeyInternal(dist->GetAppRegistrationData(), |
571 google_update::kRegProfilesActive, | 571 google_update::kRegProfilesActive, |
572 base::IntToString16(profiles_active)); | 572 base::SizeTToString16(profiles_active)); |
573 WriteGoogleUpdateStrKeyInternal(dist->GetAppRegistrationData(), | 573 WriteGoogleUpdateStrKeyInternal(dist->GetAppRegistrationData(), |
574 google_update::kRegProfilesSignedIn, | 574 google_update::kRegProfilesSignedIn, |
575 base::IntToString16(profiles_signedin)); | 575 base::SizeTToString16(profiles_signedin)); |
576 } | 576 } |
577 } | 577 } |
578 | 578 |
579 int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() { | 579 int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() { |
580 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 580 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
581 base::string16 reg_path = dist->GetStateKey(); | 581 base::string16 reg_path = dist->GetStateKey(); |
582 | 582 |
583 // Minimum access needed is to be able to write to this key. | 583 // Minimum access needed is to be able to write to this key. |
584 RegKey reg_key( | 584 RegKey reg_key( |
585 HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); | 585 HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 } | 958 } |
959 | 959 |
960 // If the key or value was not present, return the empty string. | 960 // If the key or value was not present, return the empty string. |
961 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { | 961 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { |
962 experiment_labels->clear(); | 962 experiment_labels->clear(); |
963 return true; | 963 return true; |
964 } | 964 } |
965 | 965 |
966 return result == ERROR_SUCCESS; | 966 return result == ERROR_SUCCESS; |
967 } | 967 } |
OLD | NEW |