browser_distribution.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// Use of this source code is governed by a BSD-style license that can be
3f5256e16dfc425c1d466f6308d4026d529ce9e0bHoward Hinnant// found in the LICENSE file.
4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file declares a class that contains various method related to branding.
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant
7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <string>
11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
12bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "base/basictypes.h"
13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "base/files/file_path.h"
14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "base/string16.h"
15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "base/version.h"
16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include "chrome/installer/util/util_constants.h"
17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
18bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#if defined(OS_WIN)
19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <windows.h>  // NOLINT
20bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#endif
2183e2c4d877fe2d7793868b1c6a5d9525a7c4d431Marshall Clow
22061d0cc4db18d17bf01ed14c5db0be098205bd47Marshall Clowclass BrowserDistribution {
23bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant public:
24fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  enum Type {
25fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant    CHROME_BROWSER,
26bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    CHROME_FRAME,
27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    CHROME_BINARIES,
28bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    CHROME_APP_HOST,
29bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    NUM_TYPES
30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  };
31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
32bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual ~BrowserDistribution() {}
33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  static BrowserDistribution* GetDistribution();
35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
36fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  static BrowserDistribution* GetSpecificDistribution(Type type);
37bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
38bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  Type GetType() const { return type_; }
39bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
40bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual void DoPostUninstallOperations(const Version& version,
41bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                                         const base::FilePath& local_data_path,
42bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                                         const string16& distribution_data);
43bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
44bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // Returns the GUID to be used when registering for Active Setup.
45bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetActiveSetupGuid();
46fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
47bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetAppGuid();
48bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
49fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  // Returns the unsuffixed application name of this program.
50fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  // This is the base of the name registered with Default Programs on Windows.
51bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // IMPORTANT: This should only be called by the installer which needs to make
52bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // decisions on the suffixing of the upcoming install, not by external callers
53bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // at run-time.
54fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  virtual string16 GetBaseAppName();
55fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
56bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // Returns the localized name of the program.
57bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetAppShortCutName();
58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
59bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetAlternateApplicationName();
60bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
61bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // Returns the unsuffixed appid of this program.
62bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // The AppUserModelId is a property of Windows programs.
63bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // IMPORTANT: This should only be called by ShellUtil::GetAppId as the appid
64bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  // should be suffixed in all scenarios.
65bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetBaseAppId();
66bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
67bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetInstallSubDir();
68bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
69bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetPublisherName();
70bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
71bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetAppDescription();
72fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
73fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  virtual string16 GetLongAppDescription();
74fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
75fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  virtual std::string GetSafeBrowsingName();
76fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
77fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  virtual string16 GetStateKey();
78fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
79fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  virtual string16 GetStateMediumKey();
80fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
81bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetStatsServerURL();
82bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
83bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual std::string GetNetworkStatsServer() const;
84bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
85fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant  virtual std::string GetHttpPipeliningTestServer() const;
86fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant
87fcd8db7133c56a5a627f3922ce4a180c12287dd9Howard Hinnant#if defined(OS_WIN)
88bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant  virtual string16 GetDistributionData(HKEY root_key);
89#endif
90
91  virtual string16 GetUninstallLinkName();
92
93  virtual string16 GetUninstallRegPath();
94
95  virtual string16 GetVersionKey();
96
97  virtual bool CanSetAsDefault();
98
99  virtual bool CanCreateDesktopShortcuts();
100
101  // Returns the executable filename (not path) that contains the product icon.
102  virtual string16 GetIconFilename();
103
104  // Returns the index of the icon for the product, inside the file specified by
105  // GetIconFilename().
106  virtual int GetIconIndex();
107
108  virtual bool GetChromeChannel(string16* channel);
109
110  // Returns true if this distribution includes a DelegateExecute verb handler,
111  // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is
112  // non-NULL.
113  virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid);
114
115  // Returns true if this distribution uses app_host.exe to run platform apps.
116  virtual bool AppHostIsSupported();
117
118  virtual void UpdateInstallStatus(bool system_install,
119      installer::ArchiveType archive_type,
120      installer::InstallStatus install_status);
121
122  // Returns true if this distribution should set the Omaha experiment_labels
123  // registry value.
124  virtual bool ShouldSetExperimentLabels();
125
126  virtual bool HasUserExperiments();
127
128 protected:
129  explicit BrowserDistribution(Type type);
130
131  template<class DistributionClass>
132  static BrowserDistribution* GetOrCreateBrowserDistribution(
133      BrowserDistribution** dist);
134
135  const Type type_;
136
137 private:
138  BrowserDistribution();
139
140  DISALLOW_COPY_AND_ASSIGN(BrowserDistribution);
141};
142
143#endif  // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
144