[M85 Dev][EFL] Fix errors to generate ninja files
[platform/framework/web/chromium-efl.git] / chrome / browser / startup_data.h
1 // Copyright 2019 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 CHROME_BROWSER_STARTUP_DATA_H_
6 #define CHROME_BROWSER_STARTUP_DATA_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/scoped_refptr.h"
12 #include "build/build_config.h"
13 #include "components/leveldb_proto/public/proto_database_provider.h"
14
15 namespace user_prefs {
16 class PrefRegistrySyncable;
17 }
18
19 namespace policy {
20 class ProfilePolicyConnector;
21 class SchemaRegistryService;
22 class UserCloudPolicyManager;
23 }  // namespace policy
24
25 namespace sync_preferences {
26 class PrefServiceSyncable;
27 }
28
29 class PrefService;
30 class ProfileKey;
31 class ChromeFeatureListCreator;
32
33 // The StartupData owns any pre-created objects in //chrome before the full
34 // browser starts, including the ChromeFeatureListCreator and the Profile's
35 // PrefService. See doc:
36 // https://docs.google.com/document/d/1ybmGWRWXu0aYNxA99IcHFesDAslIaO1KFP6eGdHTJaE/edit#heading=h.7bk05syrcom
37 class StartupData {
38  public:
39   StartupData();
40   ~StartupData();
41
42   // Records core profile settings into the SystemProfileProto. It is important
43   // when Chrome is running in the reduced mode, which doesn't start UMA
44   // recording but persists all of the UMA data into a memory mapped file. The
45   // file will be picked up by Chrome next time it is launched in the full
46   // browser mode.
47   void RecordCoreSystemProfile();
48
49 #if defined(OS_ANDROID)
50   // Initializes all necessary parameters to create the Profile's PrefService.
51   void CreateProfilePrefService();
52
53   // Returns whether a PrefService has been created.
54   bool HasBuiltProfilePrefService();
55
56   ProfileKey* GetProfileKey();
57
58   // Passes ownership of the |key_| to the caller.
59   std::unique_ptr<ProfileKey> TakeProfileKey();
60
61   // Passes ownership of the |schema_registry_service_| to the caller.
62   std::unique_ptr<policy::SchemaRegistryService> TakeSchemaRegistryService();
63
64   // Passes ownership of the |user_cloud_policy_manager_| to the caller.
65   std::unique_ptr<policy::UserCloudPolicyManager> TakeUserCloudPolicyManager();
66
67   // Passes ownership of the |profile_policy_connector_| to the caller.
68   std::unique_ptr<policy::ProfilePolicyConnector> TakeProfilePolicyConnector();
69
70   // Passes ownership of the |pref_registry_| to the caller.
71   scoped_refptr<user_prefs::PrefRegistrySyncable> TakePrefRegistrySyncable();
72
73   // Passes ownership of the |prefs_| to the caller.
74   std::unique_ptr<sync_preferences::PrefServiceSyncable>
75   TakeProfilePrefService();
76
77   // Passes ownership of the |proto_db_provider_| to the caller.
78   std::unique_ptr<leveldb_proto::ProtoDatabaseProvider>
79   TakeProtoDatabaseProvider();
80 #endif
81
82   ChromeFeatureListCreator* chrome_feature_list_creator() {
83     return chrome_feature_list_creator_.get();
84   }
85
86  private:
87 #if defined(OS_ANDROID)
88   void PreProfilePrefServiceInit();
89   void CreateServicesInternal();
90
91   std::unique_ptr<ProfileKey> key_;
92
93   std::unique_ptr<policy::SchemaRegistryService> schema_registry_service_;
94   std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager_;
95   std::unique_ptr<policy::ProfilePolicyConnector> profile_policy_connector_;
96
97   scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_;
98
99   std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs_;
100
101   std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> proto_db_provider_;
102 #endif
103
104   std::unique_ptr<ChromeFeatureListCreator> chrome_feature_list_creator_;
105
106   DISALLOW_COPY_AND_ASSIGN(StartupData);
107 };
108
109 #endif  // CHROME_BROWSER_STARTUP_DATA_H_