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

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

Issue 1346843003: Refactor NetworkPortalDetector and NetworkPortalNotificationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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.h
diff --git a/chromeos/network/portal_detector/network_portal_detector.h b/chromeos/network/portal_detector/network_portal_detector.h
index 3639a17bf9f102fbdbc2c97ce0babb6f40b35d3f..416139a76dae0faed2b6d88b1b6b11b4e1647dca 100644
--- a/chromeos/network/portal_detector/network_portal_detector.h
+++ b/chromeos/network/portal_detector/network_portal_detector.h
@@ -101,6 +101,15 @@ class CHROMEOS_EXPORT NetworkPortalDetector {
// doesn't equal to |id|, detection is restarted.
virtual void SetStrategy(PortalDetectorStrategy::StrategyId id) = 0;
+ // Closes portal login window before screen is locked.
+ virtual void OnLockScreenRequest() = 0;
+
+ // Returns non-localized string representation of |status|.
+ static std::string CaptivePortalStatusString(CaptivePortalStatus status);
+
+ // Creates an instance of the implementation or a stub.
+ static void Initialize(net::URLRequestContextGetter* url_context);
+
// Initializes network portal detector for testing. The
// |network_portal_detector| will be owned by the internal pointer
// and deleted by Shutdown().
@@ -119,25 +128,10 @@ class CHROMEOS_EXPORT NetworkPortalDetector {
// by calls to InitializeForTesting().
static NetworkPortalDetector* Get();
- // Returns non-localized string representation of |status|.
- static std::string CaptivePortalStatusString(CaptivePortalStatus status);
-
- // Closes portal login window before screen is locked.
- virtual void OnLockScreenRequest() = 0;
-
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;
- }
-
private:
static bool set_for_testing_;
static NetworkPortalDetector* network_portal_detector_;
@@ -145,29 +139,6 @@ class CHROMEOS_EXPORT NetworkPortalDetector {
DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetector);
};
-class CHROMEOS_EXPORT NetworkPortalDetectorStubImpl
- : public NetworkPortalDetector {
- public:
- NetworkPortalDetectorStubImpl();
- ~NetworkPortalDetectorStubImpl() override;
-
- protected:
- // NetworkPortalDetector
- void AddObserver(Observer* observer) override;
- void AddAndFireObserver(Observer* observer) override;
- void RemoveObserver(Observer* observer) override;
- CaptivePortalState GetCaptivePortalState(
- const std::string& service_path) override;
- bool IsEnabled() override;
- void Enable(bool start_detection) override;
- bool StartDetectionIfIdle() override;
- void SetStrategy(PortalDetectorStrategy::StrategyId id) override;
- void OnLockScreenRequest() override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStubImpl);
-};
-
} // namespace chromeos
#endif // CHROMEOS_NETWORK_PORTAL_DETECTOR_NETWORK_PORTAL_DETECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698