blob: 17279f1184d965388c3049b3ef88965da6a9fd6e (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
// Copyright 2014 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 IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_
#define IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_
#include <string>
#include "base/macros.h"
namespace component_updater {
class ComponentUpdateService;
}
namespace gcm {
class GCMDriver;
}
namespace ios {
class ChromeBrowserStateManager;
}
namespace metrics {
class MetricsService;
}
namespace metrics_services_manager {
class MetricsServicesManager;
}
namespace net {
class URLRequestContextGetter;
}
namespace net_log {
class ChromeNetLog;
}
namespace network_time {
class NetworkTimeTracker;
}
namespace rappor {
class RapporService;
}
namespace safe_browsing {
class SafeBrowsingService;
}
namespace variations {
class VariationsService;
}
namespace web_resource {
class PromoResourceService;
}
class ApplicationContext;
class CRLSetFetcher;
class IOSChromeIOThread;
class PrefService;
// Gets the global application context. Cannot return null.
ApplicationContext* GetApplicationContext();
class ApplicationContext {
public:
ApplicationContext();
virtual ~ApplicationContext();
// Invoked when application enters foreground. Cancels the effect of
// OnAppEnterBackground(), in particular removes the boolean preference
// indicating that the ChromeBrowserStates have been shutdown.
virtual void OnAppEnterForeground() = 0;
// Invoked when application enters background. Saves any state that must be
// saved before shutdown can continue.
virtual void OnAppEnterBackground() = 0;
// Returns whether the last complete shutdown was clean (i.e. happened while
// the application was backgrounded).
virtual bool WasLastShutdownClean() = 0;
// Gets the local state associated with this application.
virtual PrefService* GetLocalState() = 0;
// Gets the URL request context associated with this application.
virtual net::URLRequestContextGetter* GetSystemURLRequestContext() = 0;
// Gets the locale used by the application.
virtual const std::string& GetApplicationLocale() = 0;
// Gets the ChromeBrowserStateManager used by this application.
virtual ios::ChromeBrowserStateManager* GetChromeBrowserStateManager() = 0;
// Gets the manager for the various metrics-related service, constructing it
// if necessary.
virtual metrics_services_manager::MetricsServicesManager*
GetMetricsServicesManager() = 0;
// Gets the MetricsService used by this application.
virtual metrics::MetricsService* GetMetricsService() = 0;
// Gets the VariationsService used by this application.
virtual variations::VariationsService* GetVariationsService() = 0;
// Gets the RapporService. May return null.
virtual rappor::RapporService* GetRapporService() = 0;
// Gets the ChromeNetLog.
virtual net_log::ChromeNetLog* GetNetLog() = 0;
// Gets the NetworkTimeTracker.
virtual network_time::NetworkTimeTracker* GetNetworkTimeTracker() = 0;
// Gets the IOSChromeIOThread.
virtual IOSChromeIOThread* GetIOSChromeIOThread() = 0;
// Gets the GCMDriver.
virtual gcm::GCMDriver* GetGCMDriver() = 0;
// Gets the PromoResourceService.
virtual web_resource::PromoResourceService* GetPromoResourceService() = 0;
// Gets the ComponentUpdateService.
virtual component_updater::ComponentUpdateService*
GetComponentUpdateService() = 0;
// Gets the CRLSetFetcher.
virtual CRLSetFetcher* GetCRLSetFetcher() = 0;
// Gets the SafeBrowsingService.
virtual safe_browsing::SafeBrowsingService* GetSafeBrowsingService() = 0;
protected:
// Sets the global ApplicationContext instance.
static void SetApplicationContext(ApplicationContext* context);
private:
DISALLOW_COPY_AND_ASSIGN(ApplicationContext);
};
#endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_
|