Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / installer / util / browser_distribution.h
blob16d25009e361a519ce86a14c5bbe6028436bb5b6
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.
4 //
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_
10 #include <string>
12 #include "base/basictypes.h"
13 #include "base/files/file_path.h"
14 #include "base/strings/string16.h"
15 #include "base/version.h"
16 #include "chrome/installer/util/util_constants.h"
18 #if defined(OS_WIN)
19 #include <windows.h> // NOLINT
20 #endif
22 class BrowserDistribution {
23 public:
24 enum Type {
25 CHROME_BROWSER,
26 CHROME_FRAME,
27 CHROME_BINARIES,
28 CHROME_APP_HOST,
29 NUM_TYPES
32 enum ShortcutType {
33 SHORTCUT_CHROME,
34 SHORTCUT_CHROME_ALTERNATE,
35 SHORTCUT_APP_LAUNCHER
38 enum Subfolder {
39 SUBFOLDER_CHROME,
40 SUBFOLDER_APPS,
43 enum DefaultBrowserControlPolicy {
44 DEFAULT_BROWSER_UNSUPPORTED,
45 DEFAULT_BROWSER_OS_CONTROL_ONLY,
46 DEFAULT_BROWSER_FULL_CONTROL
49 virtual ~BrowserDistribution() {}
51 static BrowserDistribution* GetDistribution();
53 static BrowserDistribution* GetSpecificDistribution(Type type);
55 Type GetType() const { return type_; }
57 virtual void DoPostUninstallOperations(
58 const Version& version,
59 const base::FilePath& local_data_path,
60 const base::string16& distribution_data);
62 // Returns the GUID to be used when registering for Active Setup.
63 virtual base::string16 GetActiveSetupGuid();
65 virtual base::string16 GetAppGuid();
67 // Returns the unsuffixed application name of this program.
68 // This is the base of the name registered with Default Programs on Windows.
69 // IMPORTANT: This should only be called by the installer which needs to make
70 // decisions on the suffixing of the upcoming install, not by external callers
71 // at run-time.
72 virtual base::string16 GetBaseAppName();
74 // Returns the localized display name of this distribution.
75 virtual base::string16 GetDisplayName();
77 // Returns the localized name of the shortcut identified by |shortcut_type|
78 // for this distribution.
79 virtual base::string16 GetShortcutName(ShortcutType shortcut_type);
81 // Returns the index of the icon for the product identified by
82 // |shortcut_type|, inside the file specified by GetIconFilename().
83 virtual int GetIconIndex(ShortcutType shortcut_type);
85 // Returns the executable filename (not path) that contains the product icon.
86 virtual base::string16 GetIconFilename();
88 // Returns the localized name of the subfolder in the Start Menu identified by
89 // |subfolder_type| that this distribution should create shortcuts in. For
90 // SUBFOLDER_CHROME this returns GetShortcutName(SHORTCUT_CHROME).
91 virtual base::string16 GetStartMenuShortcutSubfolder(
92 Subfolder subfolder_type);
94 // Returns the unsuffixed appid of this program.
95 // The AppUserModelId is a property of Windows programs.
96 // IMPORTANT: This should only be called by ShellUtil::GetAppId as the appid
97 // should be suffixed in all scenarios.
98 virtual base::string16 GetBaseAppId();
100 // Returns the Browser ProgId prefix (e.g. ChromeHTML, ChromiumHTM, etc...).
101 // The full id is of the form |prefix|.|suffix| and is limited to a maximum
102 // length of 39 characters including null-terminator. See
103 // http://msdn.microsoft.com/library/aa911706.aspx for details. We define
104 // |suffix| as a fixed-length 26-character alphanumeric identifier, therefore
105 // the return value of this function must have a maximum length of
106 // 39 - 1(null-term) - 26(|suffix|) - 1(dot separator) = 11 characters.
107 virtual base::string16 GetBrowserProgIdPrefix();
109 // Returns the Browser ProgId description.
110 virtual base::string16 GetBrowserProgIdDesc();
112 virtual base::string16 GetInstallSubDir();
114 virtual base::string16 GetPublisherName();
116 virtual base::string16 GetAppDescription();
118 virtual base::string16 GetLongAppDescription();
120 virtual std::string GetSafeBrowsingName();
122 virtual base::string16 GetStateKey();
124 virtual base::string16 GetStateMediumKey();
126 virtual std::string GetNetworkStatsServer() const;
128 virtual std::string GetHttpPipeliningTestServer() const;
130 #if defined(OS_WIN)
131 virtual base::string16 GetDistributionData(HKEY root_key);
132 #endif
134 virtual base::string16 GetUninstallLinkName();
136 virtual base::string16 GetUninstallRegPath();
138 virtual base::string16 GetVersionKey();
140 // Returns an enum specifying the different ways in which this distribution
141 // is allowed to be set as default.
142 virtual DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy();
144 virtual bool CanCreateDesktopShortcuts();
146 virtual bool GetChromeChannel(base::string16* channel);
148 // Returns true if this distribution includes a DelegateExecute verb handler,
149 // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is
150 // non-NULL.
151 virtual bool GetCommandExecuteImplClsid(base::string16* handler_class_uuid);
153 // Returns true if this distribution uses app_host.exe to run platform apps.
154 virtual bool AppHostIsSupported();
156 virtual void UpdateInstallStatus(bool system_install,
157 installer::ArchiveType archive_type,
158 installer::InstallStatus install_status);
160 // Returns true if this distribution should set the Omaha experiment_labels
161 // registry value.
162 virtual bool ShouldSetExperimentLabels();
164 virtual bool HasUserExperiments();
166 protected:
167 explicit BrowserDistribution(Type type);
169 template<class DistributionClass>
170 static BrowserDistribution* GetOrCreateBrowserDistribution(
171 BrowserDistribution** dist);
173 const Type type_;
175 private:
176 BrowserDistribution();
178 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution);
181 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_