blob: 9cf30dad4beaa45074a6ee5e4a98921de91eb550 (
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
|
// 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 ios {
class ChromeBrowserStateManager;
}
namespace metrics {
class MetricsService;
}
namespace net {
class URLRequestContextGetter;
}
namespace net_log {
class ChromeNetLog;
}
namespace network_time {
class NetworkTimeTracker;
}
namespace policy {
class BrowserPolicyConnector;
}
namespace rappor {
class RapporService;
}
class ApplicationContext;
class PrefService;
// Gets the global application context. Cannot return null.
ApplicationContext* GetApplicationContext();
class ApplicationContext {
public:
ApplicationContext();
virtual ~ApplicationContext();
// 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 MetricsService used by this application.
virtual metrics::MetricsService* GetMetricsService() = 0;
// Gets the policy connector, creating and starting it if necessary.
virtual policy::BrowserPolicyConnector* GetBrowserPolicyConnector() = 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;
protected:
// Sets the global ApplicationContext instance.
static void SetApplicationContext(ApplicationContext* context);
private:
DISALLOW_COPY_AND_ASSIGN(ApplicationContext);
};
#endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_
|