<commit_before>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/command_line.h"
#include "chrome/browser/background_mode_manager.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/status_icons/status_icon.h"
#include "chrome/browser/status_icons/status_tray.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/theme_resources.h"

BackgroundModeManager::BackgroundModeManager(Profile* profile)
    : profile_(profile),
      background_app_count_(0),
      status_tray_(NULL) {
  // If background mode is disabled for unittests, just exit - don't listen for
  // any notifications.
  if (CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kDisableBackgroundMode))
    return;

  // If the -keep-alive-for-test flag is passed, then always keep chrome running
  // in the background until the user explicitly terminates it.
  if (CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kKeepAliveForTest)) {
    StartBackgroundMode();
    registrar_.Add(this, NotificationType::APP_TERMINATING,
                 NotificationService::AllSources());
  }

  // When an extension is installed, make sure launch on startup is properly
  // set if appropriate. Likewise, turn off launch on startup when the last
  // background app is uninstalled.
  registrar_.Add(this, NotificationType::EXTENSION_INSTALLED,
                 Source<Profile>(profile));
  registrar_.Add(this, NotificationType::EXTENSION_UNINSTALLED,
                 Source<Profile>(profile));<commit_msg>A quick fix for Bug 52675. This change just initializes |status_icon_| to NULL in BackgroundModeManager::BackgroundModeManager to see it actually fixes Bug 52675.<commit_after>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/command_line.h"
#include "chrome/browser/background_mode_manager.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/status_icons/status_icon.h"
#include "chrome/browser/status_icons/status_tray.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/theme_resources.h"

BackgroundModeManager::BackgroundModeManager(Profile* profile)
    : profile_(profile),
      background_app_count_(0),
      status_tray_(NULL),
      status_icon_(NULL) {
  // If background mode is disabled for unittests, just exit - don't listen for
  // any notifications.
  if (CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kDisableBackgroundMode))
    return;

  // If the -keep-alive-for-test flag is passed, then always keep chrome running
  // in the background until the user explicitly terminates it.
  if (CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kKeepAliveForTest)) {
    StartBackgroundMode();
    registrar_.Add(this, NotificationType::APP_TERMINATING,
                 NotificationService::AllSources());
  }

  // When an extension is installed, make sure launch on startup is properly
  // set if appropriate. Likewise, turn off launch on startup when the last
  // background app is uninstalled.
  registrar_.Add(this, NotificationType::EXTENSION_INSTALLED,
                 Source<Profile>(profile));
  registrar_.Add(this, NotificationType::EXTENSION_UNINSTALLED,
                 Source<Profile>(profile));
{'fraction_non_alphanumeric': 0.10789049919484701, 'fraction_numerical': 0.005521048999309869, 'mean_word_length': 4.510773130544994, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7545584', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1248, 'n_words': 319}