| 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_app_host_distribution.h" |
| 20 #include "chrome/installer/util/chrome_frame_distribution.h" | 21 #include "chrome/installer/util/chrome_frame_distribution.h" |
| 21 #include "chrome/installer/util/chromium_binaries_distribution.h" | 22 #include "chrome/installer/util/chromium_binaries_distribution.h" |
| 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() { |
| 59 // TODO(erikwright): If the app host is installed, but not Chrome, perhaps |
| 60 // this should return CHROME_APP_HOST. |
| 57 static BrowserDistribution::Type type = | 61 static BrowserDistribution::Type type = |
| 58 (MasterPreferences::ForCurrentProcess().install_chrome_frame() || | 62 (MasterPreferences::ForCurrentProcess().install_chrome_frame() || |
| 59 IsChromeFrameModule()) ? | 63 IsChromeFrameModule()) ? |
| 60 BrowserDistribution::CHROME_FRAME : | 64 BrowserDistribution::CHROME_FRAME : |
| 61 BrowserDistribution::CHROME_BROWSER; | 65 BrowserDistribution::CHROME_BROWSER; |
| 62 return type; | 66 return type; |
| 63 } | 67 } |
| 64 | 68 |
| 65 } // end namespace | 69 } // end namespace |
| 66 | 70 |
| 67 // 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. | |
| 69 const BrowserDistribution::Type BrowserDistribution::kProductTypes[] = { | |
| 70 BrowserDistribution::CHROME_BROWSER, | |
| 71 BrowserDistribution::CHROME_FRAME, | |
| 72 }; | |
| 73 | |
| 74 const size_t BrowserDistribution::kNumProductTypes = | |
| 75 arraysize(BrowserDistribution::kProductTypes); | |
| 76 | |
| 77 BrowserDistribution::BrowserDistribution() | 71 BrowserDistribution::BrowserDistribution() |
| 78 : type_(CHROME_BROWSER) { | 72 : type_(CHROME_BROWSER) { |
| 79 } | 73 } |
| 80 | 74 |
| 81 BrowserDistribution::BrowserDistribution(Type type) | 75 BrowserDistribution::BrowserDistribution(Type type) |
| 82 : type_(type) { | 76 : type_(type) { |
| 83 } | 77 } |
| 84 | 78 |
| 85 template<class DistributionClass> | 79 template<class DistributionClass> |
| 86 BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution( | 80 BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 dist = GetOrCreateBrowserDistribution<BrowserDistribution>( | 113 dist = GetOrCreateBrowserDistribution<BrowserDistribution>( |
| 120 &g_browser_distribution); | 114 &g_browser_distribution); |
| 121 #endif | 115 #endif |
| 122 break; | 116 break; |
| 123 | 117 |
| 124 case CHROME_FRAME: | 118 case CHROME_FRAME: |
| 125 dist = GetOrCreateBrowserDistribution<ChromeFrameDistribution>( | 119 dist = GetOrCreateBrowserDistribution<ChromeFrameDistribution>( |
| 126 &g_chrome_frame_distribution); | 120 &g_chrome_frame_distribution); |
| 127 break; | 121 break; |
| 128 | 122 |
| 123 case CHROME_APP_HOST: |
| 124 dist = GetOrCreateBrowserDistribution<ChromeAppHostDistribution>( |
| 125 &g_chrome_app_host_distribution); |
| 126 break; |
| 127 |
| 129 default: | 128 default: |
| 130 DCHECK_EQ(CHROME_BINARIES, type); | 129 DCHECK_EQ(CHROME_BINARIES, type); |
| 131 #if defined(GOOGLE_CHROME_BUILD) | 130 #if defined(GOOGLE_CHROME_BUILD) |
| 132 dist = GetOrCreateBrowserDistribution<GoogleChromeBinariesDistribution>( | 131 dist = GetOrCreateBrowserDistribution<GoogleChromeBinariesDistribution>( |
| 133 &g_binaries_distribution); | 132 &g_binaries_distribution); |
| 134 #else | 133 #else |
| 135 dist = GetOrCreateBrowserDistribution<ChromiumBinariesDistribution>( | 134 dist = GetOrCreateBrowserDistribution<ChromiumBinariesDistribution>( |
| 136 &g_binaries_distribution); | 135 &g_binaries_distribution); |
| 137 #endif | 136 #endif |
| 138 } | 137 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const Version& version, const installer::Product& product, | 269 const Version& version, const installer::Product& product, |
| 271 bool system_level) { | 270 bool system_level) { |
| 272 } | 271 } |
| 273 | 272 |
| 274 | 273 |
| 275 void BrowserDistribution::InactiveUserToastExperiment(int flavor, | 274 void BrowserDistribution::InactiveUserToastExperiment(int flavor, |
| 276 const string16& experiment_group, | 275 const string16& experiment_group, |
| 277 const installer::Product& installation, | 276 const installer::Product& installation, |
| 278 const FilePath& application_path) { | 277 const FilePath& application_path) { |
| 279 } | 278 } |
| OLD | NEW |