Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H | 5 #ifndef ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H |
| 6 #define ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H | 6 #define ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 8 #include "base/string16.h" | 10 #include "base/string16.h" |
| 9 | 11 |
| 10 namespace ash { | 12 namespace ash { |
| 11 | 13 |
| 12 struct NetworkIconInfo; | 14 struct NetworkIconInfo; |
| 13 class NetworkTrayDelegate; | |
| 14 | 15 |
| 15 class NetworkTrayDelegate { | 16 class NetworkTrayDelegate { |
| 16 public: | 17 public: |
| 17 virtual ~NetworkTrayDelegate() {} | 18 virtual ~NetworkTrayDelegate() {} |
| 18 | 19 |
| 19 virtual void NotificationLinkClicked() = 0; | 20 // Notifies that the |index|-th link on the notification is clicked. |
| 21 virtual void NotificationLinkClicked(size_t index) = 0; | |
| 20 }; | 22 }; |
| 21 | 23 |
| 22 class NetworkObserver { | 24 class NetworkObserver { |
| 23 public: | 25 public: |
| 24 enum ErrorType { | 26 enum MessageType { |
| 25 // Priority order, highest to lowest. | 27 // Priority order, highest to lowest. |
| 26 ERROR_CONNECT_FAILED, | 28 ERROR_CONNECT_FAILED, |
| 27 ERROR_DATA_NONE, | 29 ERROR_DATA_NONE, |
| 28 ERROR_DATA_LOW | 30 ERROR_DATA_LOW, |
|
sadrul
2012/09/13 22:47:39
Change ERROR_s to MESSAGE_s
varunjain
2012/09/13 22:54:24
Done.
| |
| 31 | |
| 32 MESSAGE_DATA_PROMO, | |
| 29 }; | 33 }; |
| 30 | 34 |
| 31 virtual ~NetworkObserver() {} | 35 virtual ~NetworkObserver() {} |
| 32 | 36 |
| 33 virtual void OnNetworkRefresh(const NetworkIconInfo& info) = 0; | 37 virtual void OnNetworkRefresh(const NetworkIconInfo& info) = 0; |
| 34 | 38 |
| 35 // Sets a network error notification. |error_type| identifies the type of | 39 // Sets a network message notification. |message_type| identifies the type of |
| 36 // error. |delegate|->NotificationLinkClicked() will be called if |link_text| | 40 // message. |delegate|->NotificationLinkClicked() will be called if any of the |
| 37 // is clicked (if supplied, |link_text| may be empty). | 41 // |links| are clicked (if supplied, |links| may be empty). |
| 38 virtual void SetNetworkError(NetworkTrayDelegate* delegate, | 42 virtual void SetNetworkMessage(NetworkTrayDelegate* delegate, |
| 39 ErrorType error_type, | 43 MessageType message_type, |
| 40 const string16& title, | 44 const string16& title, |
| 41 const string16& message, | 45 const string16& message, |
| 42 const string16& link_text) = 0; | 46 const std::vector<string16>& links) = 0; |
| 43 // Clears the error notification for |error_type|. | 47 // Clears the message notification for |message_type|. |
| 44 virtual void ClearNetworkError(ErrorType error_type) = 0; | 48 virtual void ClearNetworkMessage(MessageType message_type) = 0; |
| 45 | 49 |
| 46 // Called when the user attempted to toggle Wi-Fi enable/disable. | 50 // Called when the user attempted to toggle Wi-Fi enable/disable. |
| 47 // NOTE: Toggling is asynchronous and subsequent calls to query the current | 51 // NOTE: Toggling is asynchronous and subsequent calls to query the current |
| 48 // state may return the old value. | 52 // state may return the old value. |
| 49 virtual void OnWillToggleWifi() = 0; | 53 virtual void OnWillToggleWifi() = 0; |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 } // namespace ash | 56 } // namespace ash |
| 53 | 57 |
| 54 #endif // ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H | 58 #endif // ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H |
| OLD | NEW |