| 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_NETWORK_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NETWORK_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NETWORK_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NETWORK_MENU_BUTTON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/throb_animation.h" | 10 #include "app/throb_animation.h" |
| 11 #include "base/timer.h" | 11 #include "base/timer.h" |
| 12 #include "chrome/browser/chromeos/cros_network_library.h" | 12 #include "chrome/browser/chromeos/network_library.h" |
| 13 #include "chrome/browser/chromeos/password_dialog_view.h" | 13 #include "chrome/browser/chromeos/password_dialog_view.h" |
| 14 #include "chrome/browser/chromeos/status_area_button.h" | 14 #include "chrome/browser/chromeos/status_area_button.h" |
| 15 #include "views/controls/menu/menu_2.h" | 15 #include "views/controls/menu/menu_2.h" |
| 16 #include "views/controls/menu/view_menu_delegate.h" | 16 #include "views/controls/menu/view_menu_delegate.h" |
| 17 | 17 |
| 18 class Browser; | 18 class Browser; |
| 19 class SkBitmap; | 19 class SkBitmap; |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class Canvas; | 22 class Canvas; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace chromeos { |
| 26 |
| 25 // The network menu button in the status area. | 27 // The network menu button in the status area. |
| 26 // This class will handle getting the wifi networks and populating the menu. | 28 // This class will handle getting the wifi networks and populating the menu. |
| 27 // It will also handle the status icon changing and connecting to another | 29 // It will also handle the status icon changing and connecting to another |
| 28 // wifi network. | 30 // wifi network. |
| 29 class NetworkMenuButton : public StatusAreaButton, | 31 class NetworkMenuButton : public StatusAreaButton, |
| 30 public views::ViewMenuDelegate, | 32 public views::ViewMenuDelegate, |
| 31 public views::Menu2Model, | 33 public views::Menu2Model, |
| 32 public PasswordDialogDelegate, | 34 public PasswordDialogDelegate, |
| 33 public CrosNetworkLibrary::Observer { | 35 public NetworkLibrary::Observer { |
| 34 public: | 36 public: |
| 35 explicit NetworkMenuButton(gfx::NativeWindow browser_window); | 37 explicit NetworkMenuButton(gfx::NativeWindow browser_window); |
| 36 virtual ~NetworkMenuButton(); | 38 virtual ~NetworkMenuButton(); |
| 37 | 39 |
| 38 // views::Menu2Model implementation. | 40 // views::Menu2Model implementation. |
| 39 virtual bool HasIcons() const { return false; } | 41 virtual bool HasIcons() const { return false; } |
| 40 virtual int GetItemCount() const; | 42 virtual int GetItemCount() const; |
| 41 virtual views::Menu2Model::ItemType GetTypeAt(int index) const; | 43 virtual views::Menu2Model::ItemType GetTypeAt(int index) const; |
| 42 virtual int GetCommandIdAt(int index) const { return index; } | 44 virtual int GetCommandIdAt(int index) const { return index; } |
| 43 virtual string16 GetLabelAt(int index) const; | 45 virtual string16 GetLabelAt(int index) const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 54 virtual void MenuWillShow() {} | 56 virtual void MenuWillShow() {} |
| 55 | 57 |
| 56 // PasswordDialogDelegate implementation. | 58 // PasswordDialogDelegate implementation. |
| 57 virtual bool OnPasswordDialogCancel() { return true; } | 59 virtual bool OnPasswordDialogCancel() { return true; } |
| 58 virtual bool OnPasswordDialogAccept(const std::string& ssid, | 60 virtual bool OnPasswordDialogAccept(const std::string& ssid, |
| 59 const string16& password); | 61 const string16& password); |
| 60 | 62 |
| 61 // AnimationDelegate implementation. | 63 // AnimationDelegate implementation. |
| 62 virtual void AnimationProgressed(const Animation* animation); | 64 virtual void AnimationProgressed(const Animation* animation); |
| 63 | 65 |
| 64 // CrosNetworkLibrary::Observer implementation. | 66 // NetworkLibrary::Observer implementation. |
| 65 virtual void NetworkChanged(CrosNetworkLibrary* obj); | 67 virtual void NetworkChanged(NetworkLibrary* obj); |
| 66 virtual void NetworkTraffic(CrosNetworkLibrary* cros, | 68 virtual void NetworkTraffic(NetworkLibrary* cros, int traffic_type); |
| 67 int traffic_type); | |
| 68 | 69 |
| 69 protected: | 70 protected: |
| 70 // StatusAreaButton implementation. | 71 // StatusAreaButton implementation. |
| 71 virtual void DrawIcon(gfx::Canvas* canvas); | 72 virtual void DrawIcon(gfx::Canvas* canvas); |
| 72 | 73 |
| 73 private: | 74 private: |
| 74 // views::ViewMenuDelegate implementation. | 75 // views::ViewMenuDelegate implementation. |
| 75 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 76 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 76 | 77 |
| 77 // Set to true if we are currently refreshing the menu. | 78 // Set to true if we are currently refreshing the menu. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 106 | 107 |
| 107 // The throb animation that does the uploading animation. | 108 // The throb animation that does the uploading animation. |
| 108 ThrobAnimation animation_uploading_; | 109 ThrobAnimation animation_uploading_; |
| 109 | 110 |
| 110 // The duration of the icon throbbing in milliseconds. | 111 // The duration of the icon throbbing in milliseconds. |
| 111 static const int kThrobDuration; | 112 static const int kThrobDuration; |
| 112 | 113 |
| 113 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); | 114 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); |
| 114 }; | 115 }; |
| 115 | 116 |
| 117 } // namespace chromeos |
| 118 |
| 116 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_MENU_BUTTON_H_ | 119 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_MENU_BUTTON_H_ |
| OLD | NEW |