禁用“chrome已过期”通知 [英] Disable "chrome is out of date" notification

查看:147
本文介绍了禁用“chrome已过期”通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个触摸屏应用程序已经过优化,并在Chrome kiosk模式下运行。它完全离线运行,由于Chrome的某些更新中断了应用程序,我必须将其锁定到固定版本的Chrome(v37.x)。
我已经能够阻止Chrome使用ADM / gpedit方法自动更新自身((或者只是阅读它们以获取通知的逻辑)

  // static 
void OutdatedUpgradeBubbleView :: S howBubble

如果已显示泡泡,则不显示通知泡泡:

  //当前显示的泡泡。 
OutdatedUpgradeBubbleView * g_upgrade_bubble = nullptr;
...
if(g_upgrade_bubble)
return;

某些操作系统(基于Linux的桌面Chrome操作系统) MacOSX和非ChromeOS Linux:

  bool OutdatedUpgradeBubbleView :: IsAvailable(){
//这只应该在非Chrome操作系统的桌面平台。
#if defined(OS_WIN)||定义(OS_MACOSX)|| \
(定义(OS_LINUX)&&!defined(OS_CHROMEOS))
返回true;
#else
返回false;
#endif

它们对于气泡忽略具有最大数量,但仅用于遥测(指标),而不是禁用泡泡:

  //我们在NumLaterPerReinstall 
中跟踪的忽略泡泡的最大数量//直方图。
const int kMaxIgnored = 50;

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

  // // OutdatedUpgradeBubbleView警告用户升级已经过期。 
//它的目的是作为从
// Chrome工具栏中移除的气泡的内容。不要直接创建OutdatedUpgradeBubbleView,
//而是使用静态ShowBubble方法。

最简单的编辑是将 g_upgrade_bubble 设置为非零值。无论是使用代码编辑还是使用运行时内存编辑器,或者使用调试器,或者可能游戏教练像Cheat引擎或水手或与chrome.dll修补程序。



此泡泡从 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);
}
}



由src / chrome / browser / upgrade_detector.cc以 NOTIFICATION_OUTDATED_INSTALL >触发 https://cs.chromium。组织/铬/ SRC /铬/浏览器/ upgrade_detector.cc q = NOTIFICATI ON_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();


调用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天不测试,否则为140秒。
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;

//这些if语句必须被排序(最高的时间间隔第一个)。
if(time_passed> = severe_threshold || is_critical_or_outdated){
set_upgrade_notification_stage(
is_critical_or_outdated?UPGRADE_ANNOYANCE_CRITICAL:
UPGRADE_ANNOYANCE_SEVERE);

//我们不能再高一点,宝贝。
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; //未准备好推荐升级。
}
}

NotifyUpgradeRecommended();


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 lock it to a fixed version of Chrome (v37.x). I've been able to prevent Chrome from auto-updating itself using the ADM/gpedit methods (http://www.wikihow.com/Completely-Disable-Google-Chrome-Update), but Chrome is now displaying a message on screen to say it is out of date.

Has anybody been able to find a way to disable this notification?

解决方案

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();

这篇关于禁用“chrome已过期”通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆