1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chrome/install_static/install_modes.h"
6 
7 #include "chrome/install_static/buildflags.h"
8 
9 namespace install_static {
10 
11 namespace {
12 
13 #if BUILDFLAG(USE_GOOGLE_UPDATE_INTEGRATION)
GetClientsKeyPathForApp(const wchar_t * app_guid)14 std::wstring GetClientsKeyPathForApp(const wchar_t* app_guid) {
15   return std::wstring(L"Software\\Google\\Update\\Clients\\").append(app_guid);
16 }
17 
GetClientStateKeyPathForApp(const wchar_t * app_guid)18 std::wstring GetClientStateKeyPathForApp(const wchar_t* app_guid) {
19   return std::wstring(L"Software\\Google\\Update\\ClientState\\")
20       .append(app_guid);
21 }
22 
GetClientStateMediumKeyPathForApp(const wchar_t * app_guid)23 std::wstring GetClientStateMediumKeyPathForApp(const wchar_t* app_guid) {
24   return std::wstring(L"Software\\Google\\Update\\ClientStateMedium\\")
25       .append(app_guid);
26 }
27 #else
28 std::wstring GetUnregisteredKeyPathForProduct() {
29   return std::wstring(L"Software\\").append(kProductPathName);
30 }
31 #endif
32 
33 }  // namespace
34 
GetClientsKeyPath(const wchar_t * app_guid)35 std::wstring GetClientsKeyPath(const wchar_t* app_guid) {
36 #if !BUILDFLAG(USE_GOOGLE_UPDATE_INTEGRATION)
37   return GetUnregisteredKeyPathForProduct();
38 #else
39   return GetClientsKeyPathForApp(app_guid);
40 #endif
41 }
42 
GetClientStateKeyPath(const wchar_t * app_guid)43 std::wstring GetClientStateKeyPath(const wchar_t* app_guid) {
44 #if !BUILDFLAG(USE_GOOGLE_UPDATE_INTEGRATION)
45   return GetUnregisteredKeyPathForProduct();
46 #else
47   return GetClientStateKeyPathForApp(app_guid);
48 #endif
49 }
50 
GetClientStateMediumKeyPath(const wchar_t * app_guid)51 std::wstring GetClientStateMediumKeyPath(const wchar_t* app_guid) {
52 #if !BUILDFLAG(USE_GOOGLE_UPDATE_INTEGRATION)
53   return GetUnregisteredKeyPathForProduct();
54 #else
55   return GetClientStateMediumKeyPathForApp(app_guid);
56 #endif
57 }
58 
59 }  // namespace install_static
60