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