Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / log / trace_net_log_observer.h
blob83fe158ed5a91113fb752ceafed46d186e5d75a1
1 // Copyright 2014 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.
5 #ifndef NET_LOG_TRACE_NET_LOG_OBSERVER_H_
6 #define NET_LOG_TRACE_NET_LOG_OBSERVER_H_
8 #include "base/macros.h"
9 #include "base/trace_event/trace_event_impl.h"
10 #include "net/base/net_export.h"
11 #include "net/log/net_log.h"
13 namespace net {
15 // TraceNetLogObserver watches for TraceLog enable, and sends NetLog
16 // events to TraceLog if it is enabled.
17 class NET_EXPORT TraceNetLogObserver
18 : public NetLog::ThreadSafeObserver,
19 public base::trace_event::TraceLog::EnabledStateObserver {
20 public:
21 TraceNetLogObserver();
22 ~TraceNetLogObserver() override;
24 // net::NetLog::ThreadSafeObserver implementation:
25 void OnAddEntry(const NetLog::Entry& entry) override;
27 // Start to watch for TraceLog enable and disable events.
28 // This can't be called if already watching for events.
29 // Watches NetLog only when tracing is enabled.
30 void WatchForTraceStart(NetLog* net_log);
32 // Stop watching for TraceLog enable and disable events.
33 // If WatchForTraceStart is called, this must be called before
34 // TraceNetLogObserver is destroyed.
35 void StopWatchForTraceStart();
37 // base::trace_event::TraceLog::EnabledStateChangedObserver implementation:
38 void OnTraceLogEnabled() override;
39 void OnTraceLogDisabled() override;
41 private:
42 NetLog* net_log_to_watch_;
44 DISALLOW_COPY_AND_ASSIGN(TraceNetLogObserver);
47 } // namespace net
49 #endif // NET_LOG_TRACE_NET_LOG_OBSERVER_H_