| Index: chrome/browser/net/net_pref_observer.h
|
| diff --git a/chrome/browser/net/net_pref_observer.h b/chrome/browser/net/net_pref_observer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a55493de4757f7ce02b9b9618f469dc355a7f1a1
|
| --- /dev/null
|
| +++ b/chrome/browser/net/net_pref_observer.h
|
| @@ -0,0 +1,61 @@
|
| +// Copyright (c) 2012 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 CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_
|
| +#define CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "components/prefs/pref_member.h"
|
| +
|
| +class PrefService;
|
| +
|
| +namespace user_prefs {
|
| +class PrefRegistrySyncable;
|
| +}
|
| +
|
| +class IOThread;
|
| +
|
| +// 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 NetPrefObserver.
|
| +// Must be used only on the UI thread.
|
| +class NetPrefObserver {
|
| + public:
|
| + // Describes what change in terms of net parameters.
|
| + struct NetParamsChange {
|
| + // New value of QUIC enablement.
|
| + bool quic_enabled_new;
|
| + };
|
| +
|
| + // Type of callback which will be called when enablement of QUIC is changed.
|
| + // This callback will be called on the UI thread.
|
| + typedef base::Callback<void(NetParamsChange)> UpdateNetParamsCallback;
|
| +
|
| + // |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.
|
| + NetPrefObserver(PrefService* prefs,
|
| + UpdateNetParamsCallback update_net_params_callback);
|
| + ~NetPrefObserver();
|
| +
|
| + // Register user preferences which NetPrefObserver uses into |registry|.
|
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
| +
|
| + private:
|
| + // Called on UI thread when an observed net pref changes
|
| + void ApplySettings();
|
| +
|
| + // Called on IO thread from ApplySettings
|
| + void ApplySettingsOnIOThread(IOThread* io_thread,
|
| + NetParamsChange net_params_change);
|
| +
|
| + BooleanPrefMember quic_allowed_;
|
| + UpdateNetParamsCallback update_net_params_callback_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NetPrefObserver);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_NET_NET_PREF_OBSERVER_H_
|
|
|