| 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_CHROMEOS_NETWORK_NETWORK_OBSERVER_H | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H |
| 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 | 11 |
| 12 namespace chromeos { | |
| 13 class NetworkState; | |
| 14 } | |
| 15 | |
| 16 namespace ash { | 12 namespace ash { |
| 17 | 13 |
| 18 struct NetworkIconInfo; | |
| 19 class NetworkTrayDelegate; | |
| 20 | |
| 21 class NetworkObserver { | 14 class NetworkObserver { |
| 22 public: | 15 public: |
| 23 enum MessageType { | |
| 24 // Priority order, highest to lowest. | |
| 25 ERROR_CONNECT_FAILED, | |
| 26 ERROR_OUT_OF_CREDITS, | |
| 27 MESSAGE_DATA_PROMO, | |
| 28 }; | |
| 29 | |
| 30 enum NetworkType { | |
| 31 // ash relevant subset of network_constants.h connection type. | |
| 32 NETWORK_ETHERNET, | |
| 33 NETWORK_CELLULAR, | |
| 34 NETWORK_CELLULAR_LTE, | |
| 35 NETWORK_WIFI, | |
| 36 NETWORK_BLUETOOTH, | |
| 37 NETWORK_UNKNOWN, | |
| 38 }; | |
| 39 | |
| 40 virtual ~NetworkObserver() {} | 16 virtual ~NetworkObserver() {} |
| 41 | 17 |
| 42 // Sets a network message notification. | |
| 43 // |message_type| identifies the type of message. | |
| 44 // |network_type| identifies the type of network involved. | |
| 45 // |delegate|->NotificationLinkClicked() will be called if any of the | |
| 46 // |links| are clicked (if supplied, |links| may be empty). | |
| 47 virtual void SetNetworkMessage(NetworkTrayDelegate* delegate, | |
| 48 MessageType message_type, | |
| 49 NetworkType network_type, | |
| 50 const base::string16& title, | |
| 51 const base::string16& message, | |
| 52 const std::vector<base::string16>& links) = 0; | |
| 53 | |
| 54 // Clears the message notification for |message_type|. | |
| 55 virtual void ClearNetworkMessage(MessageType message_type) = 0; | |
| 56 | |
| 57 // Called to request toggling Wi-Fi enable/disable, e.g. from an accelerator. | 18 // Called to request toggling Wi-Fi enable/disable, e.g. from an accelerator. |
| 58 // NOTE: Toggling is asynchronous and subsequent calls to query the current | 19 // NOTE: Toggling is asynchronous and subsequent calls to query the current |
| 59 // state may return the old value. | 20 // state may return the old value. |
| 60 virtual void RequestToggleWifi() = 0; | 21 virtual void RequestToggleWifi() = 0; |
| 61 | |
| 62 // Helper function to get the network type from NetworkState. | |
| 63 static NetworkType GetNetworkTypeForNetworkState( | |
| 64 const chromeos::NetworkState* network); | |
| 65 }; | 22 }; |
| 66 | 23 |
| 67 } // namespace ash | 24 } // namespace ash |
| 68 | 25 |
| 69 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H | 26 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H |
| OLD | NEW |