| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/beacons.h" | 5 #include "chrome/installer/util/beacons.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 BrowserDistribution* distribution) { | 47 BrowserDistribution* distribution) { |
| 48 installer_util::MakeLastOsUpgradeBeacon( | 48 installer_util::MakeLastOsUpgradeBeacon( |
| 49 system_install, distribution->GetAppRegistrationData())->Update(); | 49 system_install, distribution->GetAppRegistrationData())->Update(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 namespace installer_util { | 52 namespace installer_util { |
| 53 | 53 |
| 54 std::unique_ptr<Beacon> MakeLastOsUpgradeBeacon( | 54 std::unique_ptr<Beacon> MakeLastOsUpgradeBeacon( |
| 55 bool system_install, | 55 bool system_install, |
| 56 const AppRegistrationData& registration_data) { | 56 const AppRegistrationData& registration_data) { |
| 57 return base::WrapUnique(new Beacon(L"LastOsUpgrade", Beacon::BeaconType::LAST, | 57 return base::MakeUnique<Beacon>(L"LastOsUpgrade", Beacon::BeaconType::LAST, |
| 58 Beacon::BeaconScope::PER_INSTALL, | 58 Beacon::BeaconScope::PER_INSTALL, |
| 59 system_install, registration_data)); | 59 system_install, registration_data); |
| 60 } | 60 } |
| 61 | 61 |
| 62 std::unique_ptr<Beacon> MakeLastWasDefaultBeacon( | 62 std::unique_ptr<Beacon> MakeLastWasDefaultBeacon( |
| 63 bool system_install, | 63 bool system_install, |
| 64 const AppRegistrationData& registration_data) { | 64 const AppRegistrationData& registration_data) { |
| 65 return base::WrapUnique(new Beacon( | 65 return base::MakeUnique<Beacon>(L"LastWasDefault", Beacon::BeaconType::LAST, |
| 66 L"LastWasDefault", Beacon::BeaconType::LAST, | 66 Beacon::BeaconScope::PER_USER, system_install, |
| 67 Beacon::BeaconScope::PER_USER, system_install, registration_data)); | 67 registration_data); |
| 68 } | 68 } |
| 69 | 69 |
| 70 std::unique_ptr<Beacon> MakeFirstNotDefaultBeacon( | 70 std::unique_ptr<Beacon> MakeFirstNotDefaultBeacon( |
| 71 bool system_install, | 71 bool system_install, |
| 72 const AppRegistrationData& registration_data) { | 72 const AppRegistrationData& registration_data) { |
| 73 return base::WrapUnique(new Beacon( | 73 return base::MakeUnique<Beacon>(L"FirstNotDefault", Beacon::BeaconType::FIRST, |
| 74 L"FirstNotDefault", Beacon::BeaconType::FIRST, | 74 Beacon::BeaconScope::PER_USER, system_install, |
| 75 Beacon::BeaconScope::PER_USER, system_install, registration_data)); | 75 registration_data); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Beacon ---------------------------------------------------------------------- | 78 // Beacon ---------------------------------------------------------------------- |
| 79 | 79 |
| 80 Beacon::Beacon(base::StringPiece16 name, | 80 Beacon::Beacon(base::StringPiece16 name, |
| 81 BeaconType type, | 81 BeaconType type, |
| 82 BeaconScope scope, | 82 BeaconScope scope, |
| 83 bool system_install, | 83 bool system_install, |
| 84 const AppRegistrationData& registration_data) | 84 const AppRegistrationData& registration_data) |
| 85 : type_(type), | 85 : type_(type), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 key_path_.append(name.data(), name.size()); | 145 key_path_.append(name.data(), name.size()); |
| 146 // This should never fail. If it does, the beacon will be written in the | 146 // This should never fail. If it does, the beacon will be written in the |
| 147 // key's default value, which is okay since the majority case is likely a | 147 // key's default value, which is okay since the majority case is likely a |
| 148 // machine with a single user. | 148 // machine with a single user. |
| 149 if (!base::win::GetUserSidString(&value_name_)) | 149 if (!base::win::GetUserSidString(&value_name_)) |
| 150 NOTREACHED(); | 150 NOTREACHED(); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace installer_util | 154 } // namespace installer_util |
| OLD | NEW |