// Copyright 2015 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 "chrome/browser/sessions/session_restore_delegate.h"

#include "base/metrics/field_trial.h"
#include "chrome/browser/sessions/session_restore_stats_collector.h"
#include "chrome/browser/sessions/tab_loader.h"

// static
void SessionRestoreDelegate::RestoreTabs(
    const std::vector<RestoredTab>& tabs,
    const base::TimeTicks& restore_started) {
  // TODO(georgesak): make tests aware of that behavior so that they succeed if
  // tab loading is disabled.
  base::FieldTrial* trial =
      base::FieldTrialList::Find("SessionRestoreBackgroundLoading");
  bool active_only = true;
  if (!trial || trial->group_name() != "Disabled") {
    TabLoader::RestoreTabs(tabs, restore_started);
    active_only = false;
  }
  SessionRestoreStatsCollector::TrackTabs(tabs, restore_started, active_only);
}

// Copyright 2015 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 "chrome/browser/sessions/session_restore_delegate.h"

#include "base/metrics/field_trial.h"
#include "chrome/browser/sessions/session_restore_stats_collector.h"
#include "chrome/browser/sessions/tab_loader.h"

// static
void SessionRestoreDelegate::RestoreTabs(
    const std::vector<RestoredTab>& tabs,
    const base::TimeTicks& restore_started) {
  // TODO(georgesak): make tests aware of that behavior so that they succeed if
  // tab loading is disabled.
  base::FieldTrial* trial =
      base::FieldTrialList::Find("SessionRestoreBackgroundLoading");
  bool active_only = true;
  if (!trial || trial->group_name() == "Enabled") {
    TabLoader::RestoreTabs(tabs, restore_started);
    active_only = false;
  }
  SessionRestoreStatsCollector::TrackTabs(tabs, restore_started, active_only);
}

Change logic to enable for group Enabled (for A/B testing).
Change logic to enable for group Enabled (for A/B testing).

This allows to have multiple Disabled group, e.g. Disabled/Disabled_control, and thus eases experimentation.

TBR=sky@chromium.org
BUG=465815

Review URL: https://codereview.chromium.org/1062243002

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#324099}
