| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_NOTIFICATION_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 11 #include "chromeos/network/portal_detector/network_portal_detector.h" | 12 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 12 | 13 |
| 13 namespace chromeos { | 14 namespace chromeos { |
| 14 | 15 |
| 15 class NetworkState; | 16 class NetworkState; |
| 17 class NetworkPortalWebDialog; |
| 16 | 18 |
| 17 class NetworkPortalNotificationController { | 19 class NetworkPortalNotificationController |
| 20 : public base::SupportsWeakPtr<NetworkPortalNotificationController> { |
| 18 public: | 21 public: |
| 19 // The values of these metrics are being used for UMA gathering, so it is | 22 // The values of these metrics are being used for UMA gathering, so it is |
| 20 // important that they don't change between releases. | 23 // important that they don't change between releases. |
| 21 enum NotificationMetric { | 24 enum NotificationMetric { |
| 22 NOTIFICATION_METRIC_DISPLAYED = 0, | 25 NOTIFICATION_METRIC_DISPLAYED = 0, |
| 23 | 26 |
| 24 // This value is no longer used by is still kept here just for | 27 // This value is no longer used by is still kept here just for |
| 25 // unify with histograms.xml. | 28 // unify with histograms.xml. |
| 26 NOTIFICATION_METRIC_ERROR = 1, | 29 NOTIFICATION_METRIC_ERROR = 1, |
| 27 | 30 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 static const char kNotificationMetric[]; | 43 static const char kNotificationMetric[]; |
| 41 static const char kUserActionMetric[]; | 44 static const char kUserActionMetric[]; |
| 42 | 45 |
| 43 NetworkPortalNotificationController(); | 46 NetworkPortalNotificationController(); |
| 44 virtual ~NetworkPortalNotificationController(); | 47 virtual ~NetworkPortalNotificationController(); |
| 45 | 48 |
| 46 void OnPortalDetectionCompleted( | 49 void OnPortalDetectionCompleted( |
| 47 const NetworkState* network, | 50 const NetworkState* network, |
| 48 const NetworkPortalDetector::CaptivePortalState& state); | 51 const NetworkPortalDetector::CaptivePortalState& state); |
| 49 | 52 |
| 53 // Creates NetworkPortalWebDialog. |
| 54 void ShowDialog(); |
| 55 |
| 56 // NULLifies reference to the active dialog. |
| 57 void OnDialogDestroyed(const NetworkPortalWebDialog* dialog); |
| 58 |
| 50 private: | 59 private: |
| 51 // Last network path for which notification was displayed. | 60 // Last network path for which notification was displayed. |
| 52 std::string last_network_path_; | 61 std::string last_network_path_; |
| 53 | 62 |
| 63 // Currently displayed authorization dialog, or NULL if none. |
| 64 NetworkPortalWebDialog* dialog_; |
| 65 |
| 54 DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationController); | 66 DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationController); |
| 55 }; | 67 }; |
| 56 | 68 |
| 57 } // namespace chromeos | 69 } // namespace chromeos |
| 58 | 70 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ | 71 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ |
| OLD | NEW |