summaryrefslogtreecommitdiff
path: root/chromium/weblayer/browser/browser_process.h
blob: f8f7302e6e4602d21892874969b7795ac7244fb4 (plain)
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
// Copyright 2020 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.

#ifndef WEBLAYER_BROWSER_BROWSER_PROCESS_H_
#define WEBLAYER_BROWSER_BROWSER_PROCESS_H_

#include <memory>

#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"

class PrefRegistrySimple;
class PrefService;

namespace network_time {
class NetworkTimeTracker;
}

namespace network {
class SharedURLLoaderFactory;
}

namespace weblayer {

// Class that holds global state in the browser process. Should be used only on
// the UI thread.
class BrowserProcess {
 public:
  BrowserProcess();
  ~BrowserProcess();

  static BrowserProcess* GetInstance();

  // Does cleanup that needs to occur before threads are torn down.
  void StartTearDown();

  PrefService* GetLocalState();
  scoped_refptr<network::SharedURLLoaderFactory> GetSharedURLLoaderFactory();
  network_time::NetworkTimeTracker* GetNetworkTimeTracker();

 private:
  void RegisterPrefs(PrefRegistrySimple* pref_registry);

  std::unique_ptr<PrefService> local_state_;
  std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
  SEQUENCE_CHECKER(sequence_checker_);

  DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
};

}  // namespace weblayer

#endif  // WEBLAYER_BROWSER_BROWSER_PROCESS_H_