Chromium Code Reviews| Index: chrome/browser/profiles/net_http_session_params_observer.h |
| diff --git a/chrome/browser/profiles/net_http_session_params_observer.h b/chrome/browser/profiles/net_http_session_params_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a2378f30271ac1a7c5ce37754425119f08b1d371 |
| --- /dev/null |
| +++ b/chrome/browser/profiles/net_http_session_params_observer.h |
| @@ -0,0 +1,53 @@ |
| +// 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.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ |
| +#define CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "components/prefs/pref_member.h" |
| +#include "net/http/http_network_session.h" |
| + |
| +class PrefService; |
| + |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| +// Monitors network-related preferences for changes and applies them to |
| +// globally owned HttpNetworkSessions. |
| +// Profile-owned HttpNetworkSessions are taken care of by a |
| +// UpdateNetParamsCallback passed to the constructor. |
| +// The supplied PrefService must outlive this NetHttpSessionParamsObserver. |
| +// Must be used only on the UI thread. |
| +class NetHttpSessionParamsObserver { |
| + public: |
| + // Type of callback which will be called when enablement of QUIC is changed. |
| + // This callback will be called on the IO thread. |
| + typedef base::Callback<void(net::HttpNetworkSession::ParamsUpdate)> |
| + UpdateNetParamsCallback; |
|
mmenke
2017/01/09 16:46:04
Need to include callback header (base/???/callback
pmarko
2017/01/09 19:53:12
Done.
|
| + |
| + // |prefs| must be non-NULL and |*prefs| must outlive this. |
| + // |update_net_params_callback| will be invoked on the IO thread when an |
| + // observed network parmeter is changed. |
| + NetHttpSessionParamsObserver( |
| + PrefService* prefs, |
| + UpdateNetParamsCallback update_net_params_callback); |
| + ~NetHttpSessionParamsObserver(); |
| + |
| + // Register user preferences which NetHttpSessionParamsObserver uses into |
| + // |registry|. |
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| + |
| + private: |
| + // Called on UI thread when an observed net pref changes |
| + void ApplySettings(); |
| + |
| + BooleanPrefMember quic_allowed_; |
| + UpdateNetParamsCallback update_net_params_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetHttpSessionParamsObserver); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_PROFILES_NET_HTTP_SESSION_PARAMS_OBSERVER_H_ |