chrome_version_info_win.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
1// Copyright (c) 2011 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/common/chrome_version_info.h" 6 7#include "base/base_paths.h" 8#include "base/files/file_path.h" 9#include "base/path_service.h" 10#include "base/string_util.h" 11#include "chrome/installer/util/google_update_settings.h" 12#include "chrome/installer/util/install_util.h" 13 14namespace chrome { 15 16// static 17std::string VersionInfo::GetVersionStringModifier() { 18#if defined(GOOGLE_CHROME_BUILD) 19 base::FilePath module; 20 string16 channel; 21 if (PathService::Get(base::FILE_MODULE, &module)) { 22 bool is_system_install = 23 !InstallUtil::IsPerUserInstall(module.value().c_str()); 24 25 GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install, 26 &channel); 27 } 28#if defined(USE_AURA) 29 channel += L" Aura"; 30#endif 31 return UTF16ToASCII(channel); 32#else 33 return std::string(); 34#endif 35} 36 37// static 38VersionInfo::Channel VersionInfo::GetChannel() { 39#if defined(GOOGLE_CHROME_BUILD) 40 std::wstring channel(L"unknown"); 41 42 base::FilePath module; 43 if (PathService::Get(base::FILE_MODULE, &module)) { 44 bool is_system_install = 45 !InstallUtil::IsPerUserInstall(module.value().c_str()); 46 channel = GoogleUpdateSettings::GetChromeChannel(is_system_install); 47 } 48 49 if (channel.empty()) { 50 return CHANNEL_STABLE; 51 } else if (channel == L"beta") { 52 return CHANNEL_BETA; 53 } else if (channel == L"dev") { 54 return CHANNEL_DEV; 55 } else if (channel == L"canary") { 56 return CHANNEL_CANARY; 57 } 58#endif 59 60 return CHANNEL_UNKNOWN; 61} 62 63} // namespace chrome 64