Disable “chrome is out of date” notification

前端 未结 6 430
天涯浪人
天涯浪人 2021-01-31 20:16

I have a touchscreen application optimised and running in a Chrome kiosk mode. It runs totally offline and due to some updates to Chrome breaking the application I\'ve had to lo

相关标签:
6条回答
  • 2021-01-31 20:50

    You may want to try editing sources: https://chromium.googlesource.com/chromium/src.git/+/lkcr/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc (or just read them to get the logic of the notification)

    // static
    void OutdatedUpgradeBubbleView::ShowBubble
    

    Don't show notification bubble if there is already bubble shown:

    // The currently showing bubble.
    OutdatedUpgradeBubbleView* g_upgrade_bubble = nullptr;
    ...
      if (g_upgrade_bubble)
        return;
    

    The widget is not available on some OS (desktop Chrome OS based on linux) and available on Windows, MacOSX and non-ChromeOS Linux:

    bool OutdatedUpgradeBubbleView::IsAvailable() {
    // This should only work on non-Chrome OS desktop platforms.
    #if defined(OS_WIN) || defined(OS_MACOSX) || \
        (defined(OS_LINUX) && !defined(OS_CHROMEOS))
      return true;
    #else
      return false;
    #endif
    

    They have maximum count for bubble ignores, but this is used only in telemetry (metrics), not to disable bubble:

    // The maximum number of ignored bubble we track in the NumLaterPerReinstall
    // histogram.
    const int kMaxIgnored = 50;
    

    And https://chromium.googlesource.com/chromium/src.git/+/lkcr/chrome/browser/ui/views/outdated_upgrade_bubble_view.h file

    // OutdatedUpgradeBubbleView warns the user that an upgrade is long overdue.
    // It is intended to be used as the content of a bubble anchored off of the
    // Chrome toolbar. Don't create an OutdatedUpgradeBubbleView directly,
    // instead use the static ShowBubble method.
    

    Easiest edit is to set g_upgrade_bubble to non-zero value. Either with code editing or with runtime memory editing with debugger or possibly, game trainer like Cheat Engine or smth or with "chrome.dll" patching.

    The bubble is started from src/chrome/browser/ui/views/toolbar/toolbar_view.cc https://cs.chromium.org/chromium/src/chrome/browser/ui/views/toolbar/toolbar_view.cc?q=OutdatedUpgradeBubbleView

      if (OutdatedUpgradeBubbleView::IsAvailable()) {
        registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL,
                       content::NotificationService::AllSources());
        registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU,
                       content::NotificationService::AllSources());
    
    void ToolbarView::Observe(...
      switch (type) {
        case chrome::NOTIFICATION_OUTDATED_INSTALL:
          ShowOutdatedInstallNotification(true);
          break;
        case chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU:
          ShowOutdatedInstallNotification(false);
          break;
    
    void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) {
      if (OutdatedUpgradeBubbleView::IsAvailable()) {
        OutdatedUpgradeBubbleView::ShowBubble(app_menu_button_, browser_,
                                              auto_update_enabled);
      }
    }
    

    Triggered by src/chrome/browser/upgrade_detector.cc with "NOTIFICATION_OUTDATED_INSTALL" https://cs.chromium.org/chromium/src/chrome/browser/upgrade_detector.cc?q=NOTIFICATION_OUTDATED_INSTALL&sq=package:chromium&dr=C

    void UpgradeDetector::NotifyUpgradeRecommended() {
      notify_upgrade_ = true;
    
      TriggerNotification(chrome::NOTIFICATION_UPGRADE_RECOMMENDED);
      if (upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL) {
        TriggerNotification(chrome::NOTIFICATION_OUTDATED_INSTALL);
      } else if (upgrade_available_ == UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU) {
        TriggerNotification(chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU);
      } else if (upgrade_available_ == UPGRADE_AVAILABLE_CRITICAL ||
                 critical_experiment_updates_available_) {
        TriggerCriticalUpdate();
      }
    }
    

    called from void UpgradeDetectorImpl::NotifyOnUpgradeWithTimePassed https://cs.chromium.org/chromium/src/chrome/browser/upgrade_detector_impl.cc?rcl=0&l=455

        const base::TimeDelta multiplier = IsTesting() ?
            base::TimeDelta::FromSeconds(10) : base::TimeDelta::FromDays(1);
    
        // 14 days when not testing, otherwise 140 seconds.
        const base::TimeDelta severe_threshold = 14 * multiplier;
        const base::TimeDelta high_threshold = 7 * multiplier;
        const base::TimeDelta elevated_threshold = 4 * multiplier;
        const base::TimeDelta low_threshold = 2 * multiplier;
    
        // These if statements must be sorted (highest interval first).
        if (time_passed >= severe_threshold || is_critical_or_outdated) {
          set_upgrade_notification_stage(
              is_critical_or_outdated ? UPGRADE_ANNOYANCE_CRITICAL :
                                        UPGRADE_ANNOYANCE_SEVERE);
    
          // We can't get any higher, baby.
          upgrade_notification_timer_.Stop();
        } else if (time_passed >= high_threshold) {
          set_upgrade_notification_stage(UPGRADE_ANNOYANCE_HIGH);
        } else if (time_passed >= elevated_threshold) {
          set_upgrade_notification_stage(UPGRADE_ANNOYANCE_ELEVATED);
        } else if (time_passed >= low_threshold) {
          set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW);
        } else {
          return;  // Not ready to recommend upgrade.
        }
      }
    
      NotifyUpgradeRecommended();
    
    0 讨论(0)
  • 2021-01-31 20:53

    Other answers address the core question here, about modifying Chrome or running it a certain way, but I'll give an alternative...

    We built an application used within the organisation that has similar characteristics - full screen, must work offline, some installations will be away from internet (can't get updates) etc. Two of chromes popups were annoying, namely "restore session?" and "chrome is out of date".

    Those pop-ups make sense for a browser but our app is essentially not a browser any more.

    Solution: build into an electron app. Kiosk mode and loads of other benefits (access to os, developers can show menu and dev tools etc). It also means you control when updates happen rather than Chrome auto updating, or trying to.

    Electron worked great for us.

    0 讨论(0)
  • 2021-01-31 20:59

    On the google forum some guy writes, that in order to disable automatic updates including the notification, you can set a specific GPO.

    0 讨论(0)
  • 2021-01-31 21:06

    We had same problem, but one of my colleagues got the answer (so far OK).

    We are using Windows so batch file in startup for start chrome with incognito kiosk and update interval.

    cd C:\Program Files (x86)\Google\Chrome\Application
    
    start chrome.exe --incognito --window-position=0,0 --kiosk --check-for-update-interval=604800 "facebook.com"
    
    exit    
    
    --check-for-update-interval= 7days we are restarting the PC every day so update never tiger.
    

    This command line switch is specified here.

    0 讨论(0)
  • 2021-01-31 21:10

    Step One:

    1. Run: gpedit.msc

    2. Navigate to: Local Computer Policy > Computer Configuration > Administrative Templates. Right-click Administrative Templates, and select Add/Remove Templates. Add the chrome.adm (will have to download this) template via the dialog.

    3. Go to Classic Administrative Templates/Google/Google Update/Preferences “Enable” the Auto-update check period policy override state, and disable all auto-update checks.

    4. Go to Google Update->Applications->Google Chrome “Enable” the Update policy override state, and set the policy to updates disabled

    5. Go to Google Update->Applications->Google Chrome Binaries “Enable” the Update policy override state, and set the policy to updates disabled

    6. Go to Google Update ->Applications->Update Policy Override Default “Enable” the Update policy override state, and set the policy to updates disabled

    Step Two: Go to Task Scheduler (via Administrative Tools) go to Task Scheduler Library and disable the two Chrome update entries.

    Step Three: On Chrome shortcut properties change the target to: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" /high-dpi-support=1 /force-device-scale-factor=1 --check-for-update-interval=604800

    0 讨论(0)
  • 2021-01-31 21:11

    Ubuntu + Chrome

    param that worked for me --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'

    Full launch command: google-chrome --start-fullscreen --incognito --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' "http://127.0.0.1/" &

    0 讨论(0)
提交回复
热议问题