1 // Copyright (c) 2012 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.
5 // This file declares a class that contains various method related to branding.
7 #ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
8 #define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
12 #include "base/basictypes.h"
13 #include "base/files/file_path.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h"
16 #include "base/version.h"
17 #include "chrome/installer/util/util_constants.h"
20 #include <windows.h> // NOLINT
23 class AppRegistrationData
;
25 class BrowserDistribution
{
36 SHORTCUT_CHROME_ALTERNATE
,
45 enum DefaultBrowserControlPolicy
{
46 DEFAULT_BROWSER_UNSUPPORTED
,
47 DEFAULT_BROWSER_OS_CONTROL_ONLY
,
48 DEFAULT_BROWSER_FULL_CONTROL
51 virtual ~BrowserDistribution();
53 static BrowserDistribution
* GetDistribution();
55 static BrowserDistribution
* GetSpecificDistribution(Type type
);
57 Type
GetType() const { return type_
; }
59 // Getter and adaptors for the underlying |app_reg_data_|.
60 const AppRegistrationData
& GetAppRegistrationData() const;
61 base::string16
GetAppGuid() const;
62 base::string16
GetStateKey() const;
63 base::string16
GetStateMediumKey() const;
64 base::string16
GetVersionKey() const;
66 virtual void DoPostUninstallOperations(
67 const Version
& version
,
68 const base::FilePath
& local_data_path
,
69 const base::string16
& distribution_data
);
71 // Returns the GUID to be used when registering for Active Setup.
72 virtual base::string16
GetActiveSetupGuid();
74 // Returns the unsuffixed application name of this program.
75 // This is the base of the name registered with Default Programs on Windows.
76 // IMPORTANT: This should only be called by the installer which needs to make
77 // decisions on the suffixing of the upcoming install, not by external callers
79 virtual base::string16
GetBaseAppName();
81 // Returns the localized display name of this distribution.
82 virtual base::string16
GetDisplayName();
84 // Returns the localized name of the shortcut identified by |shortcut_type|
85 // for this distribution.
86 virtual base::string16
GetShortcutName(ShortcutType shortcut_type
);
88 // Returns the index of the icon for the product identified by
89 // |shortcut_type|, inside the file specified by GetIconFilename().
90 virtual int GetIconIndex(ShortcutType shortcut_type
);
92 // Returns the executable filename (not path) that contains the product icon.
93 virtual base::string16
GetIconFilename();
95 // Returns the localized name of the subfolder in the Start Menu identified by
96 // |subfolder_type| that this distribution should create shortcuts in. For
97 // SUBFOLDER_CHROME this returns GetShortcutName(SHORTCUT_CHROME).
98 virtual base::string16
GetStartMenuShortcutSubfolder(
99 Subfolder subfolder_type
);
101 // Returns the unsuffixed appid of this program.
102 // The AppUserModelId is a property of Windows programs.
103 // IMPORTANT: This should only be called by ShellUtil::GetAppId as the appid
104 // should be suffixed in all scenarios.
105 virtual base::string16
GetBaseAppId();
107 // Returns the Browser ProgId prefix (e.g. ChromeHTML, ChromiumHTM, etc...).
108 // The full id is of the form |prefix|.|suffix| and is limited to a maximum
109 // length of 39 characters including null-terminator. See
110 // http://msdn.microsoft.com/library/aa911706.aspx for details. We define
111 // |suffix| as a fixed-length 26-character alphanumeric identifier, therefore
112 // the return value of this function must have a maximum length of
113 // 39 - 1(null-term) - 26(|suffix|) - 1(dot separator) = 11 characters.
114 virtual base::string16
GetBrowserProgIdPrefix();
116 // Returns the Browser ProgId description.
117 virtual base::string16
GetBrowserProgIdDesc();
119 virtual base::string16
GetInstallSubDir();
121 virtual base::string16
GetPublisherName();
123 virtual base::string16
GetAppDescription();
125 virtual base::string16
GetLongAppDescription();
127 virtual std::string
GetSafeBrowsingName();
129 virtual std::string
GetNetworkStatsServer() const;
132 virtual base::string16
GetDistributionData(HKEY root_key
);
135 virtual base::string16
GetUninstallLinkName();
137 virtual base::string16
GetUninstallRegPath();
139 // Returns an enum specifying the different ways in which this distribution
140 // is allowed to be set as default.
141 virtual DefaultBrowserControlPolicy
GetDefaultBrowserControlPolicy();
143 virtual bool CanCreateDesktopShortcuts();
145 virtual bool GetChromeChannel(base::string16
* channel
);
147 // Returns true if this distribution includes a DelegateExecute verb handler,
148 // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is
150 virtual bool GetCommandExecuteImplClsid(base::string16
* handler_class_uuid
);
152 virtual void UpdateInstallStatus(bool system_install
,
153 installer::ArchiveType archive_type
,
154 installer::InstallStatus install_status
);
156 // Returns true if this distribution should set the Omaha experiment_labels
158 virtual bool ShouldSetExperimentLabels();
160 virtual bool HasUserExperiments();
163 BrowserDistribution(Type type
, scoped_ptr
<AppRegistrationData
> app_reg_data
);
165 template<class DistributionClass
>
166 static BrowserDistribution
* GetOrCreateBrowserDistribution(
167 BrowserDistribution
** dist
);
171 scoped_ptr
<AppRegistrationData
> app_reg_data_
;
174 BrowserDistribution();
176 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution
);
179 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_