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/win/registry.h" | 10 #include "base/win/registry.h" |
10 #include "base/win/win_util.h" | 11 #include "base/win/win_util.h" |
11 #include "chrome/installer/util/app_registration_data.h" | 12 #include "chrome/installer/util/app_registration_data.h" |
12 #include "chrome/installer/util/browser_distribution.h" | 13 #include "chrome/installer/util/browser_distribution.h" |
13 #include "chrome/installer/util/install_util.h" | 14 #include "chrome/installer/util/install_util.h" |
14 #include "chrome/installer/util/shell_util.h" | 15 #include "chrome/installer/util/shell_util.h" |
15 | 16 |
16 void UpdateDefaultBrowserBeaconForPath(const base::FilePath& chrome_exe) { | 17 void UpdateDefaultBrowserBeaconForPath(const base::FilePath& chrome_exe) { |
17 // Getting Chrome's default state causes the beacon to be updated via a call | 18 // Getting Chrome's default state causes the beacon to be updated via a call |
18 // to UpdateDefaultBrowserBeaconWithState below. | 19 // to UpdateDefaultBrowserBeaconWithState below. |
(...skipping 24 matching lines...) Expand all Loading... |
43 } | 44 } |
44 | 45 |
45 void UpdateOsUpgradeBeacon(bool system_install, | 46 void UpdateOsUpgradeBeacon(bool system_install, |
46 BrowserDistribution* distribution) { | 47 BrowserDistribution* distribution) { |
47 installer_util::MakeLastOsUpgradeBeacon( | 48 installer_util::MakeLastOsUpgradeBeacon( |
48 system_install, distribution->GetAppRegistrationData())->Update(); | 49 system_install, distribution->GetAppRegistrationData())->Update(); |
49 } | 50 } |
50 | 51 |
51 namespace installer_util { | 52 namespace installer_util { |
52 | 53 |
53 scoped_ptr<Beacon> MakeLastOsUpgradeBeacon( | 54 std::unique_ptr<Beacon> MakeLastOsUpgradeBeacon( |
54 bool system_install, | 55 bool system_install, |
55 const AppRegistrationData& registration_data) { | 56 const AppRegistrationData& registration_data) { |
56 return make_scoped_ptr(new Beacon(L"LastOsUpgrade", Beacon::BeaconType::LAST, | 57 return base::WrapUnique(new Beacon(L"LastOsUpgrade", Beacon::BeaconType::LAST, |
57 Beacon::BeaconScope::PER_INSTALL, | 58 Beacon::BeaconScope::PER_INSTALL, |
58 system_install, registration_data)); | 59 system_install, registration_data)); |
59 } | 60 } |
60 | 61 |
61 scoped_ptr<Beacon> MakeLastWasDefaultBeacon( | 62 std::unique_ptr<Beacon> MakeLastWasDefaultBeacon( |
62 bool system_install, | 63 bool system_install, |
63 const AppRegistrationData& registration_data) { | 64 const AppRegistrationData& registration_data) { |
64 return make_scoped_ptr(new Beacon(L"LastWasDefault", Beacon::BeaconType::LAST, | 65 return base::WrapUnique(new Beacon( |
65 Beacon::BeaconScope::PER_USER, | 66 L"LastWasDefault", Beacon::BeaconType::LAST, |
66 system_install, registration_data)); | 67 Beacon::BeaconScope::PER_USER, system_install, registration_data)); |
67 } | 68 } |
68 | 69 |
69 scoped_ptr<Beacon> MakeFirstNotDefaultBeacon( | 70 std::unique_ptr<Beacon> MakeFirstNotDefaultBeacon( |
70 bool system_install, | 71 bool system_install, |
71 const AppRegistrationData& registration_data) { | 72 const AppRegistrationData& registration_data) { |
72 return make_scoped_ptr(new Beacon( | 73 return base::WrapUnique(new Beacon( |
73 L"FirstNotDefault", Beacon::BeaconType::FIRST, | 74 L"FirstNotDefault", Beacon::BeaconType::FIRST, |
74 Beacon::BeaconScope::PER_USER, system_install, registration_data)); | 75 Beacon::BeaconScope::PER_USER, system_install, registration_data)); |
75 } | 76 } |
76 | 77 |
77 // Beacon ---------------------------------------------------------------------- | 78 // Beacon ---------------------------------------------------------------------- |
78 | 79 |
79 Beacon::Beacon(base::StringPiece16 name, | 80 Beacon::Beacon(base::StringPiece16 name, |
80 BeaconType type, | 81 BeaconType type, |
81 BeaconScope scope, | 82 BeaconScope scope, |
82 bool system_install, | 83 bool system_install, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 key_path_.append(name.data(), name.size()); | 145 key_path_.append(name.data(), name.size()); |
145 // 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 |
146 // 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 |
147 // machine with a single user. | 148 // machine with a single user. |
148 if (!base::win::GetUserSidString(&value_name_)) | 149 if (!base::win::GetUserSidString(&value_name_)) |
149 NOTREACHED(); | 150 NOTREACHED(); |
150 } | 151 } |
151 } | 152 } |
152 | 153 |
153 } // namespace installer_util | 154 } // namespace installer_util |
OLD | NEW |