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 #include "chrome/installer/util/updating_app_registration_data.h"
     21 
     22 #include "installer_util_strings.h"  // NOLINT
     23 
     24 namespace {
     25 const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}";
     26 }
     27 
     28 ChromeFrameDistribution::ChromeFrameDistribution()
     29     : BrowserDistribution(
     30           CHROME_FRAME,
     31           scoped_ptr<AppRegistrationData>(
     32               new UpdatingAppRegistrationData(kChromeFrameGuid))) {
     33 }
     34 
     35 base::string16 ChromeFrameDistribution::GetBaseAppName() {
     36   return L"Google Chrome Frame";
     37 }
     38 
     39 base::string16 ChromeFrameDistribution::GetBrowserProgIdPrefix() {
     40   NOTREACHED();
     41   return base::string16();
     42 }
     43 
     44 base::string16 ChromeFrameDistribution::GetBrowserProgIdDesc() {
     45   NOTREACHED();
     46   return base::string16();
     47 }
     48 
     49 base::string16 ChromeFrameDistribution::GetDisplayName() {
     50 #if defined(GOOGLE_CHROME_BUILD)
     51   return L"Google Chrome Frame";
     52 #else
     53   return L"Chromium Frame";
     54 #endif
     55 }
     56 
     57 base::string16 ChromeFrameDistribution::GetShortcutName(
     58     ShortcutType shortcut_type) {
     59   NOTREACHED();
     60   return base::string16();
     61 }
     62 
     63 base::string16 ChromeFrameDistribution::GetInstallSubDir() {
     64   return L"Google\\Chrome Frame";
     65 }
     66 
     67 base::string16 ChromeFrameDistribution::GetPublisherName() {
     68   const base::string16& publisher_name =
     69       installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
     70   return publisher_name;
     71 }
     72 
     73 base::string16 ChromeFrameDistribution::GetAppDescription() {
     74   return L"Chrome in a Frame.";
     75 }
     76 
     77 base::string16 ChromeFrameDistribution::GetLongAppDescription() {
     78   return L"Chrome in a Frame.";
     79 }
     80 
     81 std::string ChromeFrameDistribution::GetSafeBrowsingName() {
     82   return "googlechromeframe";
     83 }
     84 
     85 std::string ChromeFrameDistribution::GetNetworkStatsServer() const {
     86   return chrome_common_net::kEchoTestServerLocation;
     87 }
     88 
     89 base::string16 ChromeFrameDistribution::GetUninstallLinkName() {
     90   return L"Uninstall Chrome Frame";
     91 }
     92 
     93 base::string16 ChromeFrameDistribution::GetUninstallRegPath() {
     94   return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
     95          L"Google Chrome Frame";
     96 }
     97 
     98 base::string16 ChromeFrameDistribution::GetIconFilename() {
     99   return installer::kChromeExe;
    100 }
    101 
    102 int ChromeFrameDistribution::GetIconIndex(ShortcutType shortcut_type) {
    103   switch (shortcut_type) {
    104     case SHORTCUT_CHROME:
    105       return 0;
    106     default:
    107       NOTREACHED();
    108       return 0;
    109   }
    110 }
    111 
    112 BrowserDistribution::DefaultBrowserControlPolicy
    113     ChromeFrameDistribution::GetDefaultBrowserControlPolicy() {
    114   return DEFAULT_BROWSER_UNSUPPORTED;
    115 }
    116 
    117 bool ChromeFrameDistribution::CanCreateDesktopShortcuts() {
    118   return false;
    119 }
    120 
    121 bool ChromeFrameDistribution::GetCommandExecuteImplClsid(
    122     base::string16* handler_class_uuid) {
    123   return false;
    124 }
    125 
    126 void ChromeFrameDistribution::UpdateInstallStatus(bool system_install,
    127     installer::ArchiveType archive_type,
    128     installer::InstallStatus install_status) {
    129 #if defined(GOOGLE_CHROME_BUILD)
    130   GoogleUpdateSettings::UpdateInstallStatus(system_install,
    131       archive_type, InstallUtil::GetInstallReturnCode(install_status),
    132       kChromeFrameGuid);
    133 #endif
    134 }
    135