blob: d8e39651e7e656ca3e4e3fb1696ff3b0bf8728e6 [file] [log] [blame]
sdefresneade99e672016-01-12 16:47:001// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef IOS_CHROME_BROWSER_IOS_CHROME_MAIN_PARTS_H_
6#define IOS_CHROME_BROWSER_IOS_CHROME_MAIN_PARTS_H_
7
dcheng942f39d72016-04-07 21:11:238#include <memory>
9
sdefresneade99e672016-01-12 16:47:0010#include "base/command_line.h"
11#include "base/macros.h"
sdefresneade99e672016-01-12 16:47:0012#include "base/metrics/field_trial.h"
Gregory Chatzinofff6523722017-11-21 01:33:5313#include "ios/chrome/browser/ios_chrome_field_trials.h"
Mark Coganec177d8742019-05-29 11:11:1214#include "ios/web/public/init/web_main_parts.h"
sdefresneade99e672016-01-12 16:47:0015
16class ApplicationContextImpl;
17class PrefService;
18
sdefresneade99e672016-01-12 16:47:0019class IOSChromeMainParts : public web::WebMainParts {
20 public:
21 explicit IOSChromeMainParts(const base::CommandLine& parsed_command_line);
22 ~IOSChromeMainParts() override;
23
24 private:
25 // web::WebMainParts implementation.
26 void PreMainMessageLoopStart() override;
27 void PreCreateThreads() override;
28 void PreMainMessageLoopRun() override;
29 void PostMainMessageLoopRun() override;
30 void PostDestroyThreads() override;
31
robliaod38f6b0a2016-10-04 19:45:3232 // Sets up the field trials and related initialization. Call only after
33 // about:flags have been converted to switches.
34 void SetupFieldTrials();
35
36 // Constructs the metrics service and initializes metrics recording.
37 void SetupMetrics();
sdefresneade99e672016-01-12 16:47:0038
39 // Starts recording of metrics. This can only be called after we have a file
40 // thread.
41 void StartMetricsRecording();
42
43 const base::CommandLine& parsed_command_line_;
44
dcheng942f39d72016-04-07 21:11:2345 std::unique_ptr<ApplicationContextImpl> application_context_;
sdefresneade99e672016-01-12 16:47:0046
47 // Statistical testing infrastructure for the entire browser. NULL until
48 // SetUpMetricsAndFieldTrials is called.
dcheng942f39d72016-04-07 21:11:2349 std::unique_ptr<base::FieldTrialList> field_trial_list_;
sdefresneade99e672016-01-12 16:47:0050
51 PrefService* local_state_;
52
Gregory Chatzinofff6523722017-11-21 01:33:5353 IOSChromeFieldTrials ios_field_trials_;
54
sdefresneade99e672016-01-12 16:47:0055 DISALLOW_COPY_AND_ASSIGN(IOSChromeMainParts);
56};
57
58#endif // IOS_CHROME_BROWSER_IOS_CHROME_MAIN_PARTS_H_