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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void DefaultNetworkChanged(const NetworkState* network); | 57 void DefaultNetworkChanged(const NetworkState* network); |
58 | 58 |
59 void OnPortalDetectionCompleted( | 59 void OnPortalDetectionCompleted( |
60 const NetworkState* network, | 60 const NetworkState* network, |
61 const NetworkPortalDetector::CaptivePortalState& state); | 61 const NetworkPortalDetector::CaptivePortalState& state); |
62 | 62 |
63 // Creates NetworkPortalWebDialog. | 63 // Creates NetworkPortalWebDialog. |
64 void ShowDialog(); | 64 void ShowDialog(); |
65 | 65 |
| 66 // Destroys NetworkPortalWebDialog. |
| 67 void CloseDialog(); |
| 68 |
66 // NULLifies reference to the active dialog. | 69 // NULLifies reference to the active dialog. |
67 void OnDialogDestroyed(const NetworkPortalWebDialog* dialog); | 70 void OnDialogDestroyed(const NetworkPortalWebDialog* dialog); |
68 | 71 |
| 72 // Ignores "No network" errors in browser tests. |
| 73 void SetIgnoreNoNetworkForTesting(); |
| 74 |
| 75 // Browser tests should be able to verify that NetworkPortalWebDialog is |
| 76 // shown. |
| 77 const NetworkPortalWebDialog* GetDialogForTesting() const; |
| 78 |
69 private: | 79 private: |
70 // Creates the default notification informing the user that a captive portal | 80 // Creates the default notification informing the user that a captive portal |
71 // has been detected. On click the captive portal login page is opened in the | 81 // has been detected. On click the captive portal login page is opened in the |
72 // browser. | 82 // browser. |
73 scoped_ptr<message_center::Notification> | 83 scoped_ptr<message_center::Notification> |
74 CreateDefaultCaptivePortalNotification(const NetworkState* network); | 84 CreateDefaultCaptivePortalNotification(const NetworkState* network); |
75 | 85 |
76 // Creates an advanced captive portal notification informing the user that a | 86 // Creates an advanced captive portal notification informing the user that a |
77 // captive portal has been detected and an extension has registered to perform | 87 // captive portal has been detected and an extension has registered to perform |
78 // captive portal authentication for that network. Gives the user the choice | 88 // captive portal authentication for that network. Gives the user the choice |
(...skipping 10 matching lines...) Expand all Loading... |
89 scoped_ptr<message_center::Notification> GetNotification( | 99 scoped_ptr<message_center::Notification> GetNotification( |
90 const NetworkState* network, | 100 const NetworkState* network, |
91 const NetworkPortalDetector::CaptivePortalState& state); | 101 const NetworkPortalDetector::CaptivePortalState& state); |
92 | 102 |
93 // Last network path for which notification was displayed. | 103 // Last network path for which notification was displayed. |
94 std::string last_network_path_; | 104 std::string last_network_path_; |
95 | 105 |
96 // Currently displayed authorization dialog, or NULL if none. | 106 // Currently displayed authorization dialog, or NULL if none. |
97 NetworkPortalWebDialog* dialog_; | 107 NetworkPortalWebDialog* dialog_; |
98 | 108 |
| 109 // Do not close Portal Login dialog on "No network" error in browser tests. |
| 110 bool ignore_no_network_for_testing_; |
| 111 |
99 DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationController); | 112 DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationController); |
100 }; | 113 }; |
101 | 114 |
102 } // namespace chromeos | 115 } // namespace chromeos |
103 | 116 |
104 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ | 117 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_NOTIFICATION_CONTROLLER_H_ |
OLD | NEW |