OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ |
| 7 |
| 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" |
| 10 #include "components/prefs/pref_member.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 QUIC is disabled. This |
| 27 // callback will be called on the IO thread. |
| 28 typedef base::Callback<void()> DisableQuicCallback; |
| 29 |
| 30 // |prefs| must be non-NULL and |*prefs| must outlive this. |
| 31 // |update_net_params_callback| will be invoked on the IO thread when an |
| 32 // observed network parmeter is changed. |
| 33 NetHttpSessionParamsObserver(PrefService* prefs, |
| 34 DisableQuicCallback disable_quic_callback); |
| 35 ~NetHttpSessionParamsObserver(); |
| 36 |
| 37 // Register user preferences which NetHttpSessionParamsObserver uses into |
| 38 // |registry|. |
| 39 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 40 |
| 41 private: |
| 42 // Called on UI thread when an observed net pref changes |
| 43 void ApplySettings(); |
| 44 |
| 45 BooleanPrefMember quic_allowed_; |
| 46 DisableQuicCallback disable_quic_callback_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(NetHttpSessionParamsObserver); |
| 49 }; |
| 50 |
| 51 #endif // CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ |
OLD | NEW |