Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/installer/util/browser_distribution.h

Issue 15255004: Refactor of BrowserDistribution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file declares a class that contains various method related to branding. 5 // This file declares a class that contains various method related to branding.
6 6
7 #ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ 7 #ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
8 #define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ 8 #define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 11 matching lines...) Expand all
22 class BrowserDistribution { 22 class BrowserDistribution {
23 public: 23 public:
24 enum Type { 24 enum Type {
25 CHROME_BROWSER, 25 CHROME_BROWSER,
26 CHROME_FRAME, 26 CHROME_FRAME,
27 CHROME_BINARIES, 27 CHROME_BINARIES,
28 CHROME_APP_HOST, 28 CHROME_APP_HOST,
29 NUM_TYPES 29 NUM_TYPES
30 }; 30 };
31 31
32 enum ShortcutEnum {
33 SHORTCUT_CHROME,
34 SHORTCUT_ALTERNATE_CHROME,
35 SHORTCUT_APP_LAUNCHER
gab 2013/05/18 23:57:22 I wouldn't add the SHORTCUT_APP_LAUNCHER entry jus
calamity 2013/05/24 02:03:11 Implemented it because chrome_app_host_operations.
36 };
37
38 enum SubfolderEnum {
39 SUBFOLDER_CHROME,
40 SUBFOLDER_APPS
gab 2013/05/18 23:57:22 Same for SUBFOLDER_APPS... don't add it yet if not
calamity 2013/05/24 02:03:11 Done.
41 };
42
43 struct ShortcutInfo {
44 string16 name;
45 string16 icon_file;
46 int icon_index;
47 };
48
32 virtual ~BrowserDistribution() {} 49 virtual ~BrowserDistribution() {}
33 50
34 static BrowserDistribution* GetDistribution(); 51 static BrowserDistribution* GetDistribution();
35 52
36 static BrowserDistribution* GetSpecificDistribution(Type type); 53 static BrowserDistribution* GetSpecificDistribution(Type type);
37 54
38 Type GetType() const { return type_; } 55 Type GetType() const { return type_; }
39 56
40 virtual void DoPostUninstallOperations(const Version& version, 57 virtual void DoPostUninstallOperations(const Version& version,
41 const base::FilePath& local_data_path, 58 const base::FilePath& local_data_path,
42 const string16& distribution_data); 59 const string16& distribution_data);
43 60
44 // Returns the GUID to be used when registering for Active Setup. 61 // Returns the GUID to be used when registering for Active Setup.
45 virtual string16 GetActiveSetupGuid(); 62 virtual string16 GetActiveSetupGuid();
46 63
47 virtual string16 GetAppGuid(); 64 virtual string16 GetAppGuid();
48 65
49 // Returns the unsuffixed application name of this program. 66 // Returns the unsuffixed application name of this program.
50 // This is the base of the name registered with Default Programs on Windows. 67 // 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 68 // 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 69 // decisions on the suffixing of the upcoming install, not by external callers
53 // at run-time. 70 // at run-time.
54 virtual string16 GetBaseAppName(); 71 virtual string16 GetBaseAppName();
55 72
56 // Returns the localized name of the program. 73 // Returns the name this distribution should use in logs.
57 virtual string16 GetAppShortCutName(); 74 virtual string16 GetDisplayName();
gab 2013/05/18 23:57:22 I hadn't realized the need sometimes to only get t
huangs 2013/05/21 21:35:41 The old code uses GetAppShortCutName() for non-sho
gab 2013/05/21 21:46:45 I think GetDisplayName() is appropriate for these.
calamity 2013/05/24 02:03:11 Changed the comment. Is there anything else to do
58 75
59 virtual string16 GetAlternateApplicationName(); 76 // Returns the ShortcutInfo for this distribution.
77 virtual ShortcutInfo GetShortcutInfo(ShortcutEnum shortcut_enum);
78
79 // Returns the name of the subfolder in the Start Menu that this distribution
80 // should create shortcuts in.
81 virtual string16 GetStartMenuShortcutSubfolder(SubfolderEnum subfolder_enum);
60 82
61 // Returns the unsuffixed appid of this program. 83 // Returns the unsuffixed appid of this program.
62 // The AppUserModelId is a property of Windows programs. 84 // The AppUserModelId is a property of Windows programs.
63 // IMPORTANT: This should only be called by ShellUtil::GetAppId as the appid 85 // IMPORTANT: This should only be called by ShellUtil::GetAppId as the appid
64 // should be suffixed in all scenarios. 86 // should be suffixed in all scenarios.
65 virtual string16 GetBaseAppId(); 87 virtual string16 GetBaseAppId();
66 88
67 virtual string16 GetInstallSubDir(); 89 virtual string16 GetInstallSubDir();
68 90
69 virtual string16 GetPublisherName(); 91 virtual string16 GetPublisherName();
(...skipping 19 matching lines...) Expand all
89 virtual string16 GetUninstallLinkName(); 111 virtual string16 GetUninstallLinkName();
90 112
91 virtual string16 GetUninstallRegPath(); 113 virtual string16 GetUninstallRegPath();
92 114
93 virtual string16 GetVersionKey(); 115 virtual string16 GetVersionKey();
94 116
95 virtual bool CanSetAsDefault(); 117 virtual bool CanSetAsDefault();
96 118
97 virtual bool CanCreateDesktopShortcuts(); 119 virtual bool CanCreateDesktopShortcuts();
98 120
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); 121 virtual bool GetChromeChannel(string16* channel);
107 122
108 // Returns true if this distribution includes a DelegateExecute verb handler, 123 // Returns true if this distribution includes a DelegateExecute verb handler,
109 // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is 124 // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is
110 // non-NULL. 125 // non-NULL.
111 virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid); 126 virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid);
112 127
113 // Returns true if this distribution uses app_host.exe to run platform apps. 128 // Returns true if this distribution uses app_host.exe to run platform apps.
114 virtual bool AppHostIsSupported(); 129 virtual bool AppHostIsSupported();
115 130
116 virtual void UpdateInstallStatus(bool system_install, 131 virtual void UpdateInstallStatus(bool system_install,
117 installer::ArchiveType archive_type, 132 installer::ArchiveType archive_type,
118 installer::InstallStatus install_status); 133 installer::InstallStatus install_status);
119 134
120 // Returns true if this distribution should set the Omaha experiment_labels 135 // Returns true if this distribution should set the Omaha experiment_labels
121 // registry value. 136 // registry value.
122 virtual bool ShouldSetExperimentLabels(); 137 virtual bool ShouldSetExperimentLabels();
123 138
124 virtual bool HasUserExperiments(); 139 virtual bool HasUserExperiments();
125 140
126 protected: 141 protected:
127 explicit BrowserDistribution(Type type); 142 explicit BrowserDistribution(Type type);
128 143
144 virtual string16 GetAppShortCutName();
gab 2013/05/18 23:57:22 I think we should get rid of GetAppShortCutName(),
calamity 2013/05/24 02:03:11 Done.
145 virtual int GetIconIndex();
146 virtual string16 GetIconFilename();
147 virtual string16 GetAlternateApplicationName();
148
149 // Icons are added to the resources of the DLL using icon names. The icon
150 // index for the app list icon is named IDR_X_APP_LIST or (for official
151 // builds) IDR_X_APP_LIST_SXS for Chrome Canary. Creating shortcuts needs to
152 // specify a resource index, which are different to icon names. They are 0
153 // based and contiguous. As Google Chrome builds have extra icons the icon for
154 // Google Chrome builds need to be higher. Unfortunately these indexes are not
155 // in any generated header file.
156 virtual int GetAppListIconIndex();
gab 2013/05/18 23:57:22 Why implement this in this CL if it not implementi
calamity 2013/05/24 02:03:11 Done.
calamity 2013/05/24 02:03:11 Done.
157
129 template<class DistributionClass> 158 template<class DistributionClass>
130 static BrowserDistribution* GetOrCreateBrowserDistribution( 159 static BrowserDistribution* GetOrCreateBrowserDistribution(
131 BrowserDistribution** dist); 160 BrowserDistribution** dist);
132 161
133 const Type type_; 162 const Type type_;
134 163
135 private: 164 private:
136 BrowserDistribution(); 165 BrowserDistribution();
137 166
138 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); 167 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution);
139 }; 168 };
140 169
141 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ 170 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698