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