Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 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" |
| 11 | 11 |
| 12 #include "base/atomicops.h" | 12 #include "base/atomicops.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
| 18 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 19 #include "chrome/common/env_vars.h" | 19 #include "chrome/common/env_vars.h" |
| 20 #include "chrome/installer/util/chrome_frame_distribution.h" | 20 #include "chrome/installer/util/chrome_frame_distribution.h" |
| 21 #include "chrome/installer/util/chromium_binaries_distribution.h" | 21 #include "chrome/installer/util/chromium_binaries_distribution.h" |
| 22 #include "chrome/installer/util/chrome_app_host_distribution.h" | |
|
grt (UTC plus 2)
2012/07/12 18:37:10
ordering
erikwright (departed)
2012/07/16 20:13:11
Done.
| |
| 23 #include "chrome/installer/util/google_chrome_binaries_distribution.h" | |
| 22 #include "chrome/installer/util/google_chrome_distribution.h" | 24 #include "chrome/installer/util/google_chrome_distribution.h" |
| 23 #include "chrome/installer/util/google_chrome_binaries_distribution.h" | |
| 24 #include "chrome/installer/util/google_chrome_sxs_distribution.h" | 25 #include "chrome/installer/util/google_chrome_sxs_distribution.h" |
| 25 #include "chrome/installer/util/install_util.h" | 26 #include "chrome/installer/util/install_util.h" |
| 26 #include "chrome/installer/util/l10n_string_util.h" | 27 #include "chrome/installer/util/l10n_string_util.h" |
| 27 #include "chrome/installer/util/master_preferences.h" | 28 #include "chrome/installer/util/master_preferences.h" |
| 28 | 29 |
| 29 #include "installer_util_strings.h" // NOLINT | 30 #include "installer_util_strings.h" // NOLINT |
| 30 | 31 |
| 31 using installer::MasterPreferences; | 32 using installer::MasterPreferences; |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 const wchar_t kCommandExecuteImplUuid[] = | 36 const wchar_t kCommandExecuteImplUuid[] = |
| 36 L"{A2DF06F9-A21A-44A8-8A99-8B9C84F29160}"; | 37 L"{A2DF06F9-A21A-44A8-8A99-8B9C84F29160}"; |
| 37 const wchar_t kDelegateExecuteLibUuid[] = | 38 const wchar_t kDelegateExecuteLibUuid[] = |
| 38 L"{7779FB70-B399-454A-AA1A-BAA850032B10}"; | 39 L"{7779FB70-B399-454A-AA1A-BAA850032B10}"; |
| 39 const wchar_t kDelegateExecuteLibVersion[] = L"1.0"; | 40 const wchar_t kDelegateExecuteLibVersion[] = L"1.0"; |
| 40 const wchar_t kICommandExecuteImplUuid[] = | 41 const wchar_t kICommandExecuteImplUuid[] = |
| 41 L"{0BA0D4E9-2259-4963-B9AE-A839F7CB7544}"; | 42 L"{0BA0D4E9-2259-4963-B9AE-A839F7CB7544}"; |
| 42 | 43 |
| 43 // The BrowserDistribution objects are never freed. | 44 // The BrowserDistribution objects are never freed. |
| 44 BrowserDistribution* g_browser_distribution = NULL; | 45 BrowserDistribution* g_browser_distribution = NULL; |
| 45 BrowserDistribution* g_chrome_frame_distribution = NULL; | 46 BrowserDistribution* g_chrome_frame_distribution = NULL; |
| 46 BrowserDistribution* g_binaries_distribution = NULL; | 47 BrowserDistribution* g_binaries_distribution = NULL; |
| 48 BrowserDistribution* g_chrome_app_host_distribution = NULL; | |
| 47 | 49 |
| 48 // Returns true if currently running in npchrome_frame.dll | 50 // Returns true if currently running in npchrome_frame.dll |
| 49 bool IsChromeFrameModule() { | 51 bool IsChromeFrameModule() { |
| 50 FilePath module_path; | 52 FilePath module_path; |
| 51 PathService::Get(base::FILE_MODULE, &module_path); | 53 PathService::Get(base::FILE_MODULE, &module_path); |
| 52 return FilePath::CompareEqualIgnoreCase(module_path.BaseName().value(), | 54 return FilePath::CompareEqualIgnoreCase(module_path.BaseName().value(), |
| 53 installer::kChromeFrameDll); | 55 installer::kChromeFrameDll); |
| 54 } | 56 } |
| 55 | 57 |
| 56 BrowserDistribution::Type GetCurrentDistributionType() { | 58 BrowserDistribution::Type GetCurrentDistributionType() { |
| 57 static BrowserDistribution::Type type = | 59 // TODO(erikwright): If the app host is installed, but not Chrome, perhaps |
| 58 (MasterPreferences::ForCurrentProcess().install_chrome_frame() || | 60 // this should return CHROME_APP_HOST. |
| 59 IsChromeFrameModule()) ? | 61 if (MasterPreferences::ForCurrentProcess().install_chrome_frame() || |
|
grt (UTC plus 2)
2012/07/12 18:37:10
did you intentionally change this so that it no lo
erikwright (departed)
2012/07/16 20:13:11
No. Fixed.
| |
| 60 BrowserDistribution::CHROME_FRAME : | 62 IsChromeFrameModule()) { |
| 61 BrowserDistribution::CHROME_BROWSER; | 63 return BrowserDistribution::CHROME_FRAME; |
| 62 return type; | 64 } else { |
| 65 return BrowserDistribution::CHROME_BROWSER; | |
| 66 } | |
| 63 } | 67 } |
| 64 | 68 |
| 65 } // end namespace | 69 } // end namespace |
| 66 | 70 |
| 67 // CHROME_BINARIES represents the binaries shared by multi-install products and | 71 // CHROME_BINARIES represents the binaries shared by multi-install products and |
| 68 // is not a product in and of itself, so it is not present in this collection. | 72 // is not a product in and of itself, so it is not present in this collection. |
| 69 const BrowserDistribution::Type BrowserDistribution::kProductTypes[] = { | 73 const BrowserDistribution::Type BrowserDistribution::kProductTypes[] = { |
|
grt (UTC plus 2)
2012/07/12 18:37:10
please check to see if it now makes sense for kPro
erikwright (departed)
2012/07/16 20:13:11
Done.
| |
| 70 BrowserDistribution::CHROME_BROWSER, | 74 BrowserDistribution::CHROME_BROWSER, |
| 71 BrowserDistribution::CHROME_FRAME, | 75 BrowserDistribution::CHROME_FRAME, |
| 76 BrowserDistribution::CHROME_APP_HOST, | |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 const size_t BrowserDistribution::kNumProductTypes = | 79 const size_t BrowserDistribution::kNumProductTypes = |
| 75 arraysize(BrowserDistribution::kProductTypes); | 80 arraysize(BrowserDistribution::kProductTypes); |
| 76 | 81 |
| 77 BrowserDistribution::BrowserDistribution() | 82 BrowserDistribution::BrowserDistribution() |
| 78 : type_(CHROME_BROWSER) { | 83 : type_(CHROME_BROWSER) { |
| 79 } | 84 } |
| 80 | 85 |
| 81 BrowserDistribution::BrowserDistribution(Type type) | 86 BrowserDistribution::BrowserDistribution(Type type) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 dist = GetOrCreateBrowserDistribution<BrowserDistribution>( | 124 dist = GetOrCreateBrowserDistribution<BrowserDistribution>( |
| 120 &g_browser_distribution); | 125 &g_browser_distribution); |
| 121 #endif | 126 #endif |
| 122 break; | 127 break; |
| 123 | 128 |
| 124 case CHROME_FRAME: | 129 case CHROME_FRAME: |
| 125 dist = GetOrCreateBrowserDistribution<ChromeFrameDistribution>( | 130 dist = GetOrCreateBrowserDistribution<ChromeFrameDistribution>( |
| 126 &g_chrome_frame_distribution); | 131 &g_chrome_frame_distribution); |
| 127 break; | 132 break; |
| 128 | 133 |
| 134 case CHROME_APP_HOST: | |
| 135 dist = GetOrCreateBrowserDistribution<ChromeAppHostDistribution>( | |
| 136 &g_chrome_app_host_distribution); | |
| 137 break; | |
| 138 | |
| 129 default: | 139 default: |
| 130 DCHECK_EQ(CHROME_BINARIES, type); | 140 DCHECK_EQ(CHROME_BINARIES, type); |
| 131 #if defined(GOOGLE_CHROME_BUILD) | 141 #if defined(GOOGLE_CHROME_BUILD) |
| 132 dist = GetOrCreateBrowserDistribution<GoogleChromeBinariesDistribution>( | 142 dist = GetOrCreateBrowserDistribution<GoogleChromeBinariesDistribution>( |
| 133 &g_binaries_distribution); | 143 &g_binaries_distribution); |
| 134 #else | 144 #else |
| 135 dist = GetOrCreateBrowserDistribution<ChromiumBinariesDistribution>( | 145 dist = GetOrCreateBrowserDistribution<ChromiumBinariesDistribution>( |
| 136 &g_binaries_distribution); | 146 &g_binaries_distribution); |
| 137 #endif | 147 #endif |
| 138 } | 148 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 const Version& version, const installer::Product& product, | 280 const Version& version, const installer::Product& product, |
| 271 bool system_level) { | 281 bool system_level) { |
| 272 } | 282 } |
| 273 | 283 |
| 274 | 284 |
| 275 void BrowserDistribution::InactiveUserToastExperiment(int flavor, | 285 void BrowserDistribution::InactiveUserToastExperiment(int flavor, |
| 276 const string16& experiment_group, | 286 const string16& experiment_group, |
| 277 const installer::Product& installation, | 287 const installer::Product& installation, |
| 278 const FilePath& application_path) { | 288 const FilePath& application_path) { |
| 279 } | 289 } |
| OLD | NEW |