OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_STATUS_NETWORK_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/throb_animation.h" | 9 #include "app/throb_animation.h" |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Disable Wifi | 39 // Disable Wifi |
40 // Disable Celluar | 40 // Disable Celluar |
41 // -------------------------------- | 41 // -------------------------------- |
42 // <IP Address> | 42 // <IP Address> |
43 // Network settings... | 43 // Network settings... |
44 // | 44 // |
45 // <icon> will show the strength of the wifi/cellular networks. | 45 // <icon> will show the strength of the wifi/cellular networks. |
46 // The label will be BOLD if the network is currently connected. | 46 // The label will be BOLD if the network is currently connected. |
47 class NetworkMenuButton : public StatusAreaButton, | 47 class NetworkMenuButton : public StatusAreaButton, |
48 public NetworkMenu, | 48 public NetworkMenu, |
49 public NetworkLibrary::Observer { | 49 public NetworkLibrary::NetworkManagerObserver, |
| 50 public NetworkLibrary::NetworkObserver, |
| 51 public NetworkLibrary::CellularDataPlanObserver { |
50 public: | 52 public: |
51 explicit NetworkMenuButton(StatusAreaHost* host); | 53 explicit NetworkMenuButton(StatusAreaHost* host); |
52 virtual ~NetworkMenuButton(); | 54 virtual ~NetworkMenuButton(); |
53 | 55 |
54 // AnimationDelegate implementation. | 56 // AnimationDelegate implementation. |
55 virtual void AnimationProgressed(const Animation* animation); | 57 virtual void AnimationProgressed(const Animation* animation); |
56 | 58 |
57 // NetworkLibrary::Observer implementation. | 59 // NetworkLibrary::NetworkManagerObserver implementation. |
58 virtual void NetworkChanged(NetworkLibrary* obj); | 60 virtual void OnNetworkManagerChanged(NetworkLibrary* cros); |
59 virtual void CellularDataPlanChanged(NetworkLibrary* obj); | 61 // NetworkLibrary::NetworkObserver implementation. |
| 62 virtual void OnNetworkChanged(NetworkLibrary* cros, const Network* network); |
| 63 // NetworkLibrary::CellularDataPlanObserver implementation. |
| 64 virtual void OnCellularDataPlanChanged(NetworkLibrary* cros); |
60 | 65 |
61 // Sets the badge icon. | 66 // Sets the badge icon. |
62 void SetBadge(const SkBitmap& badge) { badge_ = badge; } | 67 void SetBadge(const SkBitmap& badge) { badge_ = badge; } |
63 SkBitmap badge() const { return badge_; } | 68 SkBitmap badge() const { return badge_; } |
64 | 69 |
65 protected: | 70 protected: |
66 // StatusAreaButton implementation. | 71 // StatusAreaButton implementation. |
67 virtual void DrawIcon(gfx::Canvas* canvas); | 72 virtual void DrawIcon(gfx::Canvas* canvas); |
68 | 73 |
69 // NetworkMenu implementation: | 74 // NetworkMenu implementation: |
70 virtual bool IsBrowserMode() const; | 75 virtual bool IsBrowserMode() const; |
71 virtual gfx::NativeWindow GetNativeWindow() const; | 76 virtual gfx::NativeWindow GetNativeWindow() const; |
72 virtual void OpenButtonOptions() const; | 77 virtual void OpenButtonOptions() const; |
73 virtual bool ShouldOpenButtonOptions() const; | 78 virtual bool ShouldOpenButtonOptions() const; |
74 | 79 |
75 private: | 80 private: |
| 81 void SetNetworkIcon(const Network* network); |
| 82 void SetNetworkBadge(NetworkLibrary* cros, const Network* network); |
| 83 |
76 // The status area host, | 84 // The status area host, |
77 StatusAreaHost* host_; | 85 StatusAreaHost* host_; |
78 | 86 |
79 // A badge icon displayed on top of the icon. | 87 // A badge icon displayed on top of the icon. |
80 SkBitmap badge_; | 88 SkBitmap badge_; |
81 | 89 |
82 // The throb animation that does the wifi connecting animation. | 90 // The throb animation that does the wifi connecting animation. |
83 ThrobAnimation animation_connecting_; | 91 ThrobAnimation animation_connecting_; |
84 | 92 |
85 // The duration of the icon throbbing in milliseconds. | 93 // The duration of the icon throbbing in milliseconds. |
86 static const int kThrobDuration; | 94 static const int kThrobDuration; |
87 | 95 |
| 96 // If any network is currently active, this is the service path of the one |
| 97 // whose status is displayed in the network menu button. |
| 98 std::string active_network_; |
| 99 |
88 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); | 100 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); |
89 }; | 101 }; |
90 | 102 |
91 } // namespace chromeos | 103 } // namespace chromeos |
92 | 104 |
93 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ | 105 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
OLD | NEW |