| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace net { | 32 namespace net { |
| 33 class URLRequestContextGetter; | 33 class URLRequestContextGetter; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace chromeos { | 36 namespace chromeos { |
| 37 | 37 |
| 38 class NetworkPortalNotificationController; | 38 class NetworkPortalNotificationController; |
| 39 class NetworkState; | 39 class NetworkState; |
| 40 | 40 |
| 41 void InitializeNetworkPortalDetector(net::URLRequestContextGetter* url_context); |
| 42 |
| 41 // This class handles all notifications about network changes from | 43 // This class handles all notifications about network changes from |
| 42 // NetworkStateHandler and delegates portal detection for the default | 44 // NetworkStateHandler and delegates portal detection for the default |
| 43 // network to CaptivePortalService. | 45 // network to CaptivePortalService. |
| 44 class NetworkPortalDetectorImpl | 46 class NetworkPortalDetectorImpl : public NetworkPortalDetectorInterface, |
| 45 : public NetworkPortalDetector, | 47 public base::NonThreadSafe, |
| 46 public base::NonThreadSafe, | 48 public chromeos::NetworkStateHandlerObserver, |
| 47 public chromeos::NetworkStateHandlerObserver, | 49 public content::NotificationObserver, |
| 48 public content::NotificationObserver, | 50 public PortalDetectorStrategy::Delegate { |
| 49 public PortalDetectorStrategy::Delegate { | |
| 50 public: | 51 public: |
| 51 static const char kOobeDetectionResultHistogram[]; | 52 static const char kOobeDetectionResultHistogram[]; |
| 52 static const char kOobeDetectionDurationHistogram[]; | 53 static const char kOobeDetectionDurationHistogram[]; |
| 53 static const char kOobeShillOnlineHistogram[]; | 54 static const char kOobeShillOnlineHistogram[]; |
| 54 static const char kOobeShillPortalHistogram[]; | 55 static const char kOobeShillPortalHistogram[]; |
| 55 static const char kOobeShillOfflineHistogram[]; | 56 static const char kOobeShillOfflineHistogram[]; |
| 56 static const char kOobePortalToOnlineHistogram[]; | 57 static const char kOobePortalToOnlineHistogram[]; |
| 57 | 58 |
| 58 static const char kSessionDetectionResultHistogram[]; | 59 static const char kSessionDetectionResultHistogram[]; |
| 59 static const char kSessionDetectionDurationHistogram[]; | 60 static const char kSessionDetectionDurationHistogram[]; |
| 60 static const char kSessionShillOnlineHistogram[]; | 61 static const char kSessionShillOnlineHistogram[]; |
| 61 static const char kSessionShillPortalHistogram[]; | 62 static const char kSessionShillPortalHistogram[]; |
| 62 static const char kSessionShillOfflineHistogram[]; | 63 static const char kSessionShillOfflineHistogram[]; |
| 63 static const char kSessionPortalToOnlineHistogram[]; | 64 static const char kSessionPortalToOnlineHistogram[]; |
| 64 | 65 |
| 65 // Creates an instance of the implementation or a stub. | |
| 66 static void Initialize(net::URLRequestContextGetter* url_context); | |
| 67 | |
| 68 NetworkPortalDetectorImpl( | 66 NetworkPortalDetectorImpl( |
| 69 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 67 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| 70 bool create_notification_controller); | 68 bool create_notification_controller); |
| 71 ~NetworkPortalDetectorImpl() override; | 69 ~NetworkPortalDetectorImpl() override; |
| 72 | 70 |
| 73 private: | 71 private: |
| 74 friend class ::NetworkingConfigTest; | 72 friend class ::NetworkingConfigTest; |
| 75 friend class NetworkPortalDetectorImplTest; | 73 friend class NetworkPortalDetectorImplTest; |
| 76 friend class NetworkPortalDetectorImplBrowserTest; | 74 friend class NetworkPortalDetectorImplBrowserTest; |
| 77 | 75 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 DetectionAttemptCompletedReport attempt_completed_report_; | 267 DetectionAttemptCompletedReport attempt_completed_report_; |
| 270 | 268 |
| 271 base::WeakPtrFactory<NetworkPortalDetectorImpl> weak_factory_; | 269 base::WeakPtrFactory<NetworkPortalDetectorImpl> weak_factory_; |
| 272 | 270 |
| 273 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); | 271 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); |
| 274 }; | 272 }; |
| 275 | 273 |
| 276 } // namespace chromeos | 274 } // namespace chromeos |
| 277 | 275 |
| 278 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 276 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| OLD | NEW |