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

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

Issue 5729004: Merge the installer, installer_util and setup_util namespaces into a single i... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 defines a class that contains various method related to branding. 5 // This file defines a class that contains various method related to branding.
6 // It provides only default implementations of these methods. Usually to add 6 // It provides only default implementations of these methods. Usually to add
7 // specific branding, we will need to extend this class with a custom 7 // specific branding, we will need to extend this class with a custom
8 // implementation. 8 // implementation.
9 9
10 #include "chrome/installer/util/browser_distribution.h" 10 #include "chrome/installer/util/browser_distribution.h"
(...skipping 19 matching lines...) Expand all
30 // The BrowserDistribution objects are never freed. 30 // The BrowserDistribution objects are never freed.
31 BrowserDistribution* g_browser_distribution = NULL; 31 BrowserDistribution* g_browser_distribution = NULL;
32 BrowserDistribution* g_chrome_frame_distribution = NULL; 32 BrowserDistribution* g_chrome_frame_distribution = NULL;
33 BrowserDistribution* g_ceee_distribution = NULL; 33 BrowserDistribution* g_ceee_distribution = NULL;
34 34
35 // Returns true if currently running in npchrome_frame.dll 35 // Returns true if currently running in npchrome_frame.dll
36 bool IsChromeFrameModule() { 36 bool IsChromeFrameModule() {
37 FilePath module_path; 37 FilePath module_path;
38 PathService::Get(base::FILE_MODULE, &module_path); 38 PathService::Get(base::FILE_MODULE, &module_path);
39 return FilePath::CompareEqualIgnoreCase(module_path.BaseName().value(), 39 return FilePath::CompareEqualIgnoreCase(module_path.BaseName().value(),
40 installer_util::kChromeFrameDll); 40 installer::kChromeFrameDll);
41 } 41 }
42 42
43 // Returns true if currently running in ceee_broker.exe 43 // Returns true if currently running in ceee_broker.exe
44 bool IsCeeeBrokerProcess() { 44 bool IsCeeeBrokerProcess() {
45 FilePath exe_path; 45 FilePath exe_path;
46 PathService::Get(base::FILE_EXE, &exe_path); 46 PathService::Get(base::FILE_EXE, &exe_path);
47 return FilePath::CompareEqualIgnoreCase(exe_path.BaseName().value(), 47 return FilePath::CompareEqualIgnoreCase(exe_path.BaseName().value(),
48 installer_util::kCeeeBrokerExe); 48 installer::kCeeeBrokerExe);
49 } 49 }
50 50
51 BrowserDistribution::Type GetCurrentDistributionType() { 51 BrowserDistribution::Type GetCurrentDistributionType() {
52 static BrowserDistribution::Type type = 52 static BrowserDistribution::Type type =
53 (InstallUtil::IsChromeFrameProcess() || IsChromeFrameModule()) ? 53 (InstallUtil::IsChromeFrameProcess() || IsChromeFrameModule()) ?
54 BrowserDistribution::CHROME_FRAME : 54 BrowserDistribution::CHROME_FRAME :
55 BrowserDistribution::CHROME_BROWSER; 55 BrowserDistribution::CHROME_BROWSER;
56 return type; 56 return type;
57 } 57 }
58 58
59 } // end namespace 59 } // end namespace
60 60
61 BrowserDistribution::BrowserDistribution( 61 BrowserDistribution::BrowserDistribution(
62 const installer_util::MasterPreferences& prefs) 62 const installer::MasterPreferences& prefs)
63 : type_(BrowserDistribution::CHROME_BROWSER) { 63 : type_(BrowserDistribution::CHROME_BROWSER) {
64 } 64 }
65 65
66 template<class DistributionClass> 66 template<class DistributionClass>
67 BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution( 67 BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution(
68 const installer_util::MasterPreferences& prefs, 68 const installer::MasterPreferences& prefs,
69 BrowserDistribution** dist) { 69 BrowserDistribution** dist) {
70 if (!*dist) { 70 if (!*dist) {
71 DistributionClass* temp = new DistributionClass(prefs); 71 DistributionClass* temp = new DistributionClass(prefs);
72 if (base::subtle::NoBarrier_CompareAndSwap( 72 if (base::subtle::NoBarrier_CompareAndSwap(
73 reinterpret_cast<base::subtle::AtomicWord*>(dist), NULL, 73 reinterpret_cast<base::subtle::AtomicWord*>(dist), NULL,
74 reinterpret_cast<base::subtle::AtomicWord>(temp)) != NULL) 74 reinterpret_cast<base::subtle::AtomicWord>(temp)) != NULL)
75 delete temp; 75 delete temp;
76 } 76 }
77 77
78 return *dist; 78 return *dist;
79 } 79 }
80 80
81 BrowserDistribution* BrowserDistribution::GetDistribution() { 81 BrowserDistribution* BrowserDistribution::GetDistribution() {
82 const installer_util::MasterPreferences& prefs = 82 const installer::MasterPreferences& prefs =
83 installer_util::MasterPreferences::ForCurrentProcess(); 83 installer::MasterPreferences::ForCurrentProcess();
84 return GetSpecificDistribution(GetCurrentDistributionType(), prefs); 84 return GetSpecificDistribution(GetCurrentDistributionType(), prefs);
85 } 85 }
86 86
87 // static 87 // static
88 BrowserDistribution* BrowserDistribution::GetSpecificDistribution( 88 BrowserDistribution* BrowserDistribution::GetSpecificDistribution(
89 BrowserDistribution::Type type, 89 BrowserDistribution::Type type,
90 const installer_util::MasterPreferences& prefs) { 90 const installer::MasterPreferences& prefs) {
91 BrowserDistribution* dist = NULL; 91 BrowserDistribution* dist = NULL;
92 92
93 if (type == CHROME_FRAME) { 93 if (type == CHROME_FRAME) {
94 dist = GetOrCreateBrowserDistribution<ChromeFrameDistribution>( 94 dist = GetOrCreateBrowserDistribution<ChromeFrameDistribution>(
95 prefs, &g_chrome_frame_distribution); 95 prefs, &g_chrome_frame_distribution);
96 } else { 96 } else {
97 DCHECK_EQ(CHROME_BROWSER, type); 97 DCHECK_EQ(CHROME_BROWSER, type);
98 #if defined(GOOGLE_CHROME_BUILD) 98 #if defined(GOOGLE_CHROME_BUILD)
99 if (InstallUtil::IsChromeSxSProcess()) { 99 if (InstallUtil::IsChromeSxSProcess()) {
100 dist = GetOrCreateBrowserDistribution<GoogleChromeSxSDistribution>( 100 dist = GetOrCreateBrowserDistribution<GoogleChromeSxSDistribution>(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 std::wstring BrowserDistribution::GetPublisherName() { 144 std::wstring BrowserDistribution::GetPublisherName() {
145 return L"Chromium"; 145 return L"Chromium";
146 } 146 }
147 147
148 std::wstring BrowserDistribution::GetAppDescription() { 148 std::wstring BrowserDistribution::GetAppDescription() {
149 return L"Browse the web"; 149 return L"Browse the web";
150 } 150 }
151 151
152 std::wstring BrowserDistribution::GetLongAppDescription() { 152 std::wstring BrowserDistribution::GetLongAppDescription() {
153 const std::wstring& app_description = 153 const std::wstring& app_description =
154 installer_util::GetLocalizedString(IDS_PRODUCT_DESCRIPTION_BASE); 154 installer::GetLocalizedString(IDS_PRODUCT_DESCRIPTION_BASE);
155 return app_description; 155 return app_description;
156 } 156 }
157 157
158 // static 158 // static
159 int BrowserDistribution::GetInstallReturnCode( 159 int BrowserDistribution::GetInstallReturnCode(
160 installer_util::InstallStatus status) { 160 installer::InstallStatus status) {
161 switch (status) { 161 switch (status) {
162 case installer_util::FIRST_INSTALL_SUCCESS: 162 case installer::FIRST_INSTALL_SUCCESS:
163 case installer_util::INSTALL_REPAIRED: 163 case installer::INSTALL_REPAIRED:
164 case installer_util::NEW_VERSION_UPDATED: 164 case installer::NEW_VERSION_UPDATED:
165 case installer_util::IN_USE_UPDATED: 165 case installer::IN_USE_UPDATED:
166 return 0; 166 return 0;
167 default: 167 default:
168 return status; 168 return status;
169 } 169 }
170 } 170 }
171 171
172 std::string BrowserDistribution::GetSafeBrowsingName() { 172 std::string BrowserDistribution::GetSafeBrowsingName() {
173 return "chromium"; 173 return "chromium";
174 } 174 }
175 175
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 int BrowserDistribution::GetIconIndex() { 208 int BrowserDistribution::GetIconIndex() {
209 return 0; 209 return 0;
210 } 210 }
211 211
212 bool BrowserDistribution::GetChromeChannel(std::wstring* channel) { 212 bool BrowserDistribution::GetChromeChannel(std::wstring* channel) {
213 return false; 213 return false;
214 } 214 }
215 215
216 void BrowserDistribution::UpdateDiffInstallStatus(bool system_install, 216 void BrowserDistribution::UpdateDiffInstallStatus(bool system_install,
217 bool incremental_install, installer_util::InstallStatus install_status) { 217 bool incremental_install, installer::InstallStatus install_status) {
218 } 218 }
219 219
220 void BrowserDistribution::LaunchUserExperiment( 220 void BrowserDistribution::LaunchUserExperiment(
221 installer_util::InstallStatus status, const installer::Version& version, 221 installer::InstallStatus status, const installer::Version& version,
222 const installer::Product& installation, bool system_level) { 222 const installer::Product& installation, bool system_level) {
223 } 223 }
224 224
225 225
226 void BrowserDistribution::InactiveUserToastExperiment(int flavor, 226 void BrowserDistribution::InactiveUserToastExperiment(int flavor,
227 const installer::Product& installation) { 227 const installer::Product& installation) {
228 } 228 }
229 229
230 std::vector<FilePath> BrowserDistribution::GetKeyFiles() { 230 std::vector<FilePath> BrowserDistribution::GetKeyFiles() {
231 std::vector<FilePath> key_files; 231 std::vector<FilePath> key_files;
232 key_files.push_back(FilePath(installer_util::kChromeDll)); 232 key_files.push_back(FilePath(installer::kChromeDll));
233 return key_files; 233 return key_files;
234 } 234 }
235 235
236 std::vector<FilePath> BrowserDistribution::GetComDllList() { 236 std::vector<FilePath> BrowserDistribution::GetComDllList() {
237 return std::vector<FilePath>(); 237 return std::vector<FilePath>();
238 } 238 }
239 239
240 void BrowserDistribution::AppendUninstallCommandLineFlags( 240 void BrowserDistribution::AppendUninstallCommandLineFlags(
241 CommandLine* cmd_line) { 241 CommandLine* cmd_line) {
242 DCHECK(cmd_line); 242 DCHECK(cmd_line);
243 cmd_line->AppendSwitch(installer_util::switches::kChrome); 243 cmd_line->AppendSwitch(installer::switches::kChrome);
244 } 244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698