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::NetworkManagerObserver, | 49 public NetworkLibrary::Observer { |
50 public NetworkLibrary::NetworkObserver, | |
51 public NetworkLibrary::CellularDataPlanObserver { | |
52 public: | 50 public: |
53 explicit NetworkMenuButton(StatusAreaHost* host); | 51 explicit NetworkMenuButton(StatusAreaHost* host); |
54 virtual ~NetworkMenuButton(); | 52 virtual ~NetworkMenuButton(); |
55 | 53 |
56 // AnimationDelegate implementation. | 54 // AnimationDelegate implementation. |
57 virtual void AnimationProgressed(const Animation* animation); | 55 virtual void AnimationProgressed(const Animation* animation); |
58 | 56 |
59 // NetworkLibrary::NetworkManagerObserver implementation. | 57 // NetworkLibrary::Observer implementation. |
60 virtual void OnNetworkManagerChanged(NetworkLibrary* cros); | 58 virtual void NetworkChanged(NetworkLibrary* obj); |
61 // NetworkLibrary::NetworkObserver implementation. | 59 virtual void CellularDataPlanChanged(NetworkLibrary* obj); |
62 virtual void OnNetworkChanged(NetworkLibrary* cros, const Network* network); | |
63 // NetworkLibrary::CellularDataPlanObserver implementation. | |
64 virtual void OnCellularDataPlanChanged(NetworkLibrary* cros); | |
65 | 60 |
66 // Sets the badge icon. | 61 // Sets the badge icon. |
67 void SetBadge(const SkBitmap& badge) { badge_ = badge; } | 62 void SetBadge(const SkBitmap& badge) { badge_ = badge; } |
68 SkBitmap badge() const { return badge_; } | 63 SkBitmap badge() const { return badge_; } |
69 | 64 |
70 protected: | 65 protected: |
71 // StatusAreaButton implementation. | 66 // StatusAreaButton implementation. |
72 virtual void DrawIcon(gfx::Canvas* canvas); | 67 virtual void DrawIcon(gfx::Canvas* canvas); |
73 | 68 |
74 // NetworkMenu implementation: | 69 // NetworkMenu implementation: |
75 virtual bool IsBrowserMode() const; | 70 virtual bool IsBrowserMode() const; |
76 virtual gfx::NativeWindow GetNativeWindow() const; | 71 virtual gfx::NativeWindow GetNativeWindow() const; |
77 virtual void OpenButtonOptions() const; | 72 virtual void OpenButtonOptions() const; |
78 virtual bool ShouldOpenButtonOptions() const; | 73 virtual bool ShouldOpenButtonOptions() const; |
79 | 74 |
80 private: | 75 private: |
81 void SetNetworkIcon(const Network* network); | |
82 void SetNetworkBadge(NetworkLibrary* cros, const Network* network); | |
83 | |
84 // The status area host, | 76 // The status area host, |
85 StatusAreaHost* host_; | 77 StatusAreaHost* host_; |
86 | 78 |
87 // A badge icon displayed on top of the icon. | 79 // A badge icon displayed on top of the icon. |
88 SkBitmap badge_; | 80 SkBitmap badge_; |
89 | 81 |
90 // The throb animation that does the wifi connecting animation. | 82 // The throb animation that does the wifi connecting animation. |
91 ThrobAnimation animation_connecting_; | 83 ThrobAnimation animation_connecting_; |
92 | 84 |
93 // The duration of the icon throbbing in milliseconds. | 85 // The duration of the icon throbbing in milliseconds. |
94 static const int kThrobDuration; | 86 static const int kThrobDuration; |
95 | 87 |
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 | |
100 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); | 88 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); |
101 }; | 89 }; |
102 | 90 |
103 } // namespace chromeos | 91 } // namespace chromeos |
104 | 92 |
105 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ | 93 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
OLD | NEW |