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

Unified Diff: chromeos/network/portal_detector/network_portal_detector_interface.h

Issue 1353933002: NetworkPortalDetectorInterface class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@portal_refactor
Patch Set: rebase Created 5 years, 3 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: chromeos/network/portal_detector/network_portal_detector_interface.h
diff --git a/chromeos/network/portal_detector/network_portal_detector.h b/chromeos/network/portal_detector/network_portal_detector_interface.h
similarity index 72%
copy from chromeos/network/portal_detector/network_portal_detector.h
copy to chromeos/network/portal_detector/network_portal_detector_interface.h
index 38843fe8c22bf1a6ebad28de199350757eb4d278..65a3aa59c1b12477c7d0a2dc2a1c6783c000b7d1 100644
--- a/chromeos/network/portal_detector/network_portal_detector.h
+++ b/chromeos/network/portal_detector/network_portal_detector_interface.h
@@ -1,9 +1,9 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 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 CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_H_
-#define CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_H_
+#ifndef CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_INTERFACE_H_
+#define CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_INTERFACE_H_
#include "base/basictypes.h"
#include "chromeos/chromeos_export.h"
@@ -17,13 +17,13 @@ class NetworkState;
// This class handles all notifications about network changes from
// NetworkStateHandler and delegates portal detection for the active
// network to CaptivePortalService.
-class CHROMEOS_EXPORT NetworkPortalDetector {
+class CHROMEOS_EXPORT NetworkPortalDetectorInterface {
public:
enum CaptivePortalStatus {
- CAPTIVE_PORTAL_STATUS_UNKNOWN = 0,
- CAPTIVE_PORTAL_STATUS_OFFLINE = 1,
- CAPTIVE_PORTAL_STATUS_ONLINE = 2,
- CAPTIVE_PORTAL_STATUS_PORTAL = 3,
+ CAPTIVE_PORTAL_STATUS_UNKNOWN = 0,
+ CAPTIVE_PORTAL_STATUS_OFFLINE = 1,
+ CAPTIVE_PORTAL_STATUS_ONLINE = 2,
+ CAPTIVE_PORTAL_STATUS_PORTAL = 3,
CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED = 4,
CAPTIVE_PORTAL_STATUS_COUNT
};
@@ -31,8 +31,7 @@ class CHROMEOS_EXPORT NetworkPortalDetector {
struct CaptivePortalState {
CaptivePortalState()
: status(CAPTIVE_PORTAL_STATUS_UNKNOWN),
- response_code(net::URLFetcher::RESPONSE_CODE_INVALID) {
- }
+ response_code(net::URLFetcher::RESPONSE_CODE_INVALID) {}
bool operator==(const CaptivePortalState& o) const {
return status == o.status && response_code == o.response_code;
@@ -60,6 +59,8 @@ class CHROMEOS_EXPORT NetworkPortalDetector {
virtual ~Observer() {}
};
+ virtual ~NetworkPortalDetectorInterface() {}
+
// Adds |observer| to the observers list.
virtual void AddObserver(Observer* observer) = 0;
@@ -107,44 +108,13 @@ class CHROMEOS_EXPORT NetworkPortalDetector {
// Returns non-localized string representation of |status|.
static std::string CaptivePortalStatusString(CaptivePortalStatus status);
- // Initializes network portal detector for testing. The
- // |network_portal_detector| will be owned by the internal pointer
- // and deleted by Shutdown().
- static void InitializeForTesting(
- NetworkPortalDetector* network_portal_detector);
-
- // Returns |true| if NetworkPortalDetector was Initialized and it is safe to
- // call Get.
- static bool IsInitialized();
-
- // Deletes the instance of the NetworkPortalDetector.
- static void Shutdown();
-
- // Gets the instance of the NetworkPortalDetector. Return value should
- // be used carefully in tests, because it can be changed "on the fly"
- // by calls to InitializeForTesting().
- static NetworkPortalDetector* Get();
-
protected:
- NetworkPortalDetector() {}
- virtual ~NetworkPortalDetector() {}
-
- static bool set_for_testing() { return set_for_testing_; }
- static NetworkPortalDetector* network_portal_detector() {
- return network_portal_detector_;
- }
- static void set_network_portal_detector(
- NetworkPortalDetector* network_portal_detector) {
- network_portal_detector_ = network_portal_detector;
- }
+ NetworkPortalDetectorInterface() {}
private:
- static bool set_for_testing_;
- static NetworkPortalDetector* network_portal_detector_;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetector);
+ DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorInterface);
};
} // namespace chromeos
-#endif // CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_H_
+#endif // CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_INTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698