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 defines a specific implementation of BrowserDistribution class for
      6 // Chrome Frame. It overrides the bare minimum of methods necessary to get a
      7 // Chrome Frame installer that does not interact with Google Chrome or
      8 // Chromium installations.
      9 
     10 #include "chrome/installer/util/chrome_frame_distribution.h"
     11 
     12 #include "base/strings/string_util.h"
     13 #include "chrome/common/net/test_server_locations.h"
     14 #include "chrome/installer/util/channel_info.h"
     15 #include "chrome/installer/util/google_update_constants.h"
     16 #include "chrome/installer/util/google_update_settings.h"
     17 #include "chrome/installer/util/helper.h"
     18 #include "chrome/installer/util/install_util.h"
     19 #include "chrome/installer/util/l10n_string_util.h"
     20 
     21 #include "installer_util_strings.h"  // NOLINT
     22 
     23 namespace {
     24 const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}";
     25 }
     26 
     27 ChromeFrameDistribution::ChromeFrameDistribution()
     28     : BrowserDistribution(CHROME_FRAME) {
     29 }
     30 
     31 string16 ChromeFrameDistribution::GetAppGuid() {
     32   return kChromeFrameGuid;
     33 }
     34 
     35 string16 ChromeFrameDistribution::GetBaseAppName() {
     36   return L"Google Chrome Frame";
     37 }
     38 
     39 string16 ChromeFrameDistribution::GetAppShortCutName() {
     40   const string16& product_name =
     41       installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE);
     42   return product_name;
     43 }
     44 
     45 string16 ChromeFrameDistribution::GetAlternateApplicationName() {
     46   const string16& product_name =
     47       installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE);
     48   return product_name;
     49 }
     50 
     51 string16 ChromeFrameDistribution::GetInstallSubDir() {
     52   return L"Google\\Chrome Frame";
     53 }
     54 
     55 string16 ChromeFrameDistribution::GetPublisherName() {
     56   const string16& publisher_name =
     57       installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
     58   return publisher_name;
     59 }
     60 
     61 string16 ChromeFrameDistribution::GetAppDescription() {
     62   return L"Chrome in a Frame.";
     63 }
     64 
     65 string16 ChromeFrameDistribution::GetLongAppDescription() {
     66   return L"Chrome in a Frame.";
     67 }
     68 
     69 std::string ChromeFrameDistribution::GetSafeBrowsingName() {
     70   return "googlechromeframe";
     71 }
     72 
     73 string16 ChromeFrameDistribution::GetStateKey() {
     74   string16 key(google_update::kRegPathClientState);
     75   key.append(L"\\");
     76   key.append(kChromeFrameGuid);
     77   return key;
     78 }
     79 
     80 string16 ChromeFrameDistribution::GetStateMediumKey() {
     81   string16 key(google_update::kRegPathClientStateMedium);
     82   key.append(L"\\");
     83   key.append(kChromeFrameGuid);
     84   return key;
     85 }
     86 
     87 std::string ChromeFrameDistribution::GetNetworkStatsServer() const {
     88   return chrome_common_net::kEchoTestServerLocation;
     89 }
     90 
     91 std::string ChromeFrameDistribution::GetHttpPipeliningTestServer() const {
     92   return chrome_common_net::kPipelineTestServerBaseUrl;
     93 }
     94 
     95 string16 ChromeFrameDistribution::GetUninstallLinkName() {
     96   return L"Uninstall Chrome Frame";
     97 }
     98 
     99 string16 ChromeFrameDistribution::GetUninstallRegPath() {
    100   return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
    101          L"Google Chrome Frame";
    102 }
    103 
    104 string16 ChromeFrameDistribution::GetVersionKey() {
    105   string16 key(google_update::kRegPathClients);
    106   key.append(L"\\");
    107   key.append(kChromeFrameGuid);
    108   return key;
    109 }
    110 
    111 string16 ChromeFrameDistribution::GetIconFilename() {
    112   return installer::kChromeExe;
    113 }
    114 
    115 int ChromeFrameDistribution::GetIconIndex() {
    116   return 0;
    117 }
    118 
    119 bool ChromeFrameDistribution::CanSetAsDefault() {
    120   return false;
    121 }
    122 
    123 bool ChromeFrameDistribution::CanCreateDesktopShortcuts() {
    124   return false;
    125 }
    126 
    127 bool ChromeFrameDistribution::GetCommandExecuteImplClsid(
    128     string16* handler_class_uuid) {
    129   return false;
    130 }
    131 
    132 void ChromeFrameDistribution::UpdateInstallStatus(bool system_install,
    133     installer::ArchiveType archive_type,
    134     installer::InstallStatus install_status) {
    135 #if defined(GOOGLE_CHROME_BUILD)
    136   GoogleUpdateSettings::UpdateInstallStatus(system_install,
    137       archive_type, InstallUtil::GetInstallReturnCode(install_status),
    138       kChromeFrameGuid);
    139 #endif
    140 }
    141