Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1995)

Unified Diff: chrome/browser/local_discovery/privet_traffic_detector.h

Issue 1553333002: Move cloud print specific files out of local_discovery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moveprn
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/local_discovery/privet_traffic_detector.h
diff --git a/chrome/browser/local_discovery/privet_traffic_detector.h b/chrome/browser/local_discovery/privet_traffic_detector.h
deleted file mode 100644
index 0ff0d13e48e9363a74a950a931ca2ed83f829652..0000000000000000000000000000000000000000
--- a/chrome/browser/local_discovery/privet_traffic_detector.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2013 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_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_
-#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_
-
-#include "base/callback.h"
-#include "base/cancelable_callback.h"
-#include "base/macros.h"
-#include "content/public/browser/browser_thread.h"
-#include "net/base/address_family.h"
-#include "net/base/ip_endpoint.h"
-#include "net/base/network_change_notifier.h"
-
-namespace net {
-class DatagramServerSocket;
-class IOBufferWithSize;
-}
-
-namespace local_discovery {
-
-// Detects mDns traffic that looks like "Privet" protocol.
-// Can produce false positives results, but main task of the class is to avoid
-// running full mDns listener if user doesn't have devices.
-// When traffic is detected, class fires callback and shutdowns itself.
-class PrivetTrafficDetector
- : public base::RefCountedThreadSafe<
- PrivetTrafficDetector, content::BrowserThread::DeleteOnIOThread>,
- private net::NetworkChangeNotifier::NetworkChangeObserver {
- public:
- PrivetTrafficDetector(net::AddressFamily address_family,
- const base::Closure& on_traffic_detected);
-
- void Start();
-
- private:
- friend struct content::BrowserThread::DeleteOnThread<
- content::BrowserThread::IO>;
- friend class base::DeleteHelper<PrivetTrafficDetector>;
- ~PrivetTrafficDetector() override;
-
- // net::NetworkChangeNotifier::NetworkChangeObserver implementation.
- void OnNetworkChanged(
- net::NetworkChangeNotifier::ConnectionType type) override;
-
- void StartOnIOThread();
- void ScheduleRestart();
- void Restart(const net::NetworkInterfaceList& networks);
- int Bind();
- bool IsSourceAcceptable() const;
- bool IsPrivetPacket(int rv) const;
- int DoLoop(int rv);
-
- base::Closure on_traffic_detected_;
- scoped_refptr<base::TaskRunner> callback_runner_;
- net::NetworkInterfaceList networks_;
- net::AddressFamily address_family_;
- net::IPEndPoint recv_addr_;
- scoped_ptr<net::DatagramServerSocket> socket_;
- scoped_refptr<net::IOBufferWithSize> io_buffer_;
- base::Time start_time_;
- int restart_attempts_;
-
- base::WeakPtrFactory<PrivetTrafficDetector> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PrivetTrafficDetector);
-};
-
-} // namespace local_discovery
-
-#endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698