OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
mmenke
2017/01/09 16:46:04
2017, new files should not use the (c).
pmarko
2017/01/09 19:53:12
Done.
| |
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_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ | |
6 #define CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/prefs/pref_member.h" | |
10 #include "net/http/http_network_session.h" | |
11 | |
12 class PrefService; | |
13 | |
14 namespace user_prefs { | |
15 class PrefRegistrySyncable; | |
16 } | |
17 | |
18 // Monitors network-related preferences for changes and applies them to | |
19 // globally owned HttpNetworkSessions. | |
20 // Profile-owned HttpNetworkSessions are taken care of by a | |
21 // UpdateNetParamsCallback passed to the constructor. | |
22 // The supplied PrefService must outlive this NetHttpSessionParamsObserver. | |
23 // Must be used only on the UI thread. | |
24 class NetHttpSessionParamsObserver { | |
25 public: | |
26 // Type of callback which will be called when enablement of QUIC is changed. | |
27 // This callback will be called on the IO thread. | |
28 typedef base::Callback<void(net::HttpNetworkSession::ParamsUpdate)> | |
29 UpdateNetParamsCallback; | |
mmenke
2017/01/09 16:46:04
Need to include callback header (base/???/callback
pmarko
2017/01/09 19:53:12
Done.
| |
30 | |
31 // |prefs| must be non-NULL and |*prefs| must outlive this. | |
32 // |update_net_params_callback| will be invoked on the IO thread when an | |
33 // observed network parmeter is changed. | |
34 NetHttpSessionParamsObserver( | |
35 PrefService* prefs, | |
36 UpdateNetParamsCallback update_net_params_callback); | |
37 ~NetHttpSessionParamsObserver(); | |
38 | |
39 // Register user preferences which NetHttpSessionParamsObserver uses into | |
40 // |registry|. | |
41 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
42 | |
43 private: | |
44 // Called on UI thread when an observed net pref changes | |
45 void ApplySettings(); | |
46 | |
47 BooleanPrefMember quic_allowed_; | |
48 UpdateNetParamsCallback update_net_params_callback_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(NetHttpSessionParamsObserver); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ | |
OLD | NEW |