1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71

content / public / browser / background_sync_parameters.h [blame]

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_SYNC_PARAMETERS_H_
#define CONTENT_PUBLIC_BROWSER_BACKGROUND_SYNC_PARAMETERS_H_

#include <stdint.h>

#include "base/time/time.h"
#include "build/build_config.h"
#include "content/common/content_export.h"

namespace content {

struct CONTENT_EXPORT BackgroundSyncParameters {
  BackgroundSyncParameters();
  BackgroundSyncParameters(const BackgroundSyncParameters& other);
  BackgroundSyncParameters& operator=(const BackgroundSyncParameters& other);
  bool operator==(const BackgroundSyncParameters& other) const;

  // True if the manager should be disabled and registration attempts should
  // fail.
  bool disable;

#if BUILDFLAG(IS_ANDROID)
  // True if we should rely on Android's network detection where possible.
  bool rely_on_android_network_detection;
#endif

  // If true, we keep the browser awake till all (periodic)sync events fired
  // have completed. If false, we only keep the browser awake till all ready
  // (periodic)sync events have been fired.
  bool keep_browser_awake_till_events_complete;

  // True if the manager should skip checking for permissions.
  bool skip_permissions_check_for_testing;

  // The number of attempts the BackgroundSyncManager will make to fire an
  // event before giving up.
  int max_sync_attempts;

  // The number of attempts the BackgroundSyncManager will make to fire an
  // event before giving up, assuming the origin has notification permission.
  // This value will override |max_sync_attempts| assuming the Sync
  // Registration's origin has notification permissions.
  int max_sync_attempts_with_notification_permission;

  // The first time that a registration retries, it will wait at least this much
  // time before doing so.
  base::TimeDelta initial_retry_delay;

  // The factor by which retry delay increases. The retry time is determined by:
  // initial_retry_delay * pow(retry_delay_factor, |attempts|-1).
  int retry_delay_factor;

  // The minimum time to wait before waking the browser in case the browser
  // closes mid-sync.
  base::TimeDelta min_sync_recovery_time;

  // The maximum amount of time that a sync event can run for.
  base::TimeDelta max_sync_event_duration;

  // The minimum time interval between first attempts of Periodic Background
  // Sync events for a given registration.
  base::TimeDelta min_periodic_sync_events_interval;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_BACKGROUND_SYNC_PARAMETERS_H_