15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file defines implementation of GoogleChromeSxSDistribution. 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/installer/util/google_chrome_sxs_distribution.h" 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/command_line.h" 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/logging.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "installer_util_strings.h" // NOLINT 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace { 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const wchar_t kChannelName[] = L"canary"; 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const wchar_t kBrowserAppId[] = L"ChromeCanary"; 19d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM"; 20d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document"; 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int kSxSIconIndex = 4; 22d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)const wchar_t kCommandExecuteImplUuid[] = 23d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) L"{1BEAC3E3-B852-44F4-B468-8906C062422E}"; 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 253551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc. 263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)const int kSxSAppLauncherIconIndex = 6; 273551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)GoogleChromeSxSDistribution::GoogleChromeSxSDistribution() 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) : GoogleChromeDistribution() { 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GoogleChromeDistribution::set_product_guid(kChromeSxSGuid); 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)string16 GoogleChromeSxSDistribution::GetBaseAppName() { 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return L"Google Chrome Canary"; 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)string16 GoogleChromeSxSDistribution::GetShortcutName( 403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) ShortcutType shortcut_type) { 413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) switch (shortcut_type) { 423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) case SHORTCUT_CHROME_ALTERNATE: 433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // This should never be called. Returning the same string as Google Chrome 443551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // preserves behavior, but it will result in a naming collision. 453551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) NOTREACHED(); 463551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) return GoogleChromeDistribution::GetShortcutName(shortcut_type); 473551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) case SHORTCUT_APP_LAUNCHER: 483551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) return installer::GetLocalizedString( 493551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE); 503551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) default: 513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) DCHECK_EQ(shortcut_type, SHORTCUT_CHROME); 523551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); 533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) } 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 56a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)string16 GoogleChromeSxSDistribution::GetStartMenuShortcutSubfolder( 57a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) Subfolder subfolder_type) { 58a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) switch (subfolder_type) { 59a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) case SUBFOLDER_APPS: 60a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return installer::GetLocalizedString( 61a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY_BASE); 62a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) default: 63a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) DCHECK_EQ(subfolder_type, SUBFOLDER_CHROME); 64a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return GetShortcutName(SHORTCUT_CHROME); 65a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) } 66a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 67a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)string16 GoogleChromeSxSDistribution::GetBaseAppId() { 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return kBrowserAppId; 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 72d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() { 73d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) return kBrowserProgIdPrefix; 74d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)} 75d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 76d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() { 77d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) return kBrowserProgIdDesc; 78d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)} 79d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)string16 GoogleChromeSxSDistribution::GetInstallSubDir() { 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return GoogleChromeDistribution::GetInstallSubDir().append( 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) installer::kSxSSuffix); 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)string16 GoogleChromeSxSDistribution::GetUninstallRegPath() { 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return GoogleChromeDistribution::GetUninstallRegPath().append( 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) installer::kSxSSuffix); 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 901e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)BrowserDistribution::DefaultBrowserControlPolicy 911e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() { 921e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) return DEFAULT_BROWSER_OS_CONTROL_ONLY; 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 953551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) { 963551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) if (shortcut_type == SHORTCUT_APP_LAUNCHER) 973551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) return kSxSAppLauncherIconIndex; 983551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) DCHECK(shortcut_type == SHORTCUT_CHROME || 993551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type; 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return kSxSIconIndex; 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) { 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *channel = kChannelName; 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return true; 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid( 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) string16* handler_class_uuid) { 110d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) if (handler_class_uuid) 111d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) *handler_class_uuid = kCommandExecuteImplUuid; 112d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) return true; 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool GoogleChromeSxSDistribution::AppHostIsSupported() { 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return false; 1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() { 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return true; 1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool GoogleChromeSxSDistribution::HasUserExperiments() { 1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return true; 1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)string16 GoogleChromeSxSDistribution::ChannelName() { 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return kChannelName; 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 130