Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: chrome/browser/chromeos/status/network_menu.h

Issue 7520037: [cros] Network dropdown button in WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move handle click Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ 6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/cros/network_library.h" // ConnectionType 13 #include "chrome/browser/chromeos/cros/network_library.h" // ConnectionType
14 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow 14 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow
15 #include "views/controls/menu/menu_delegate.h"
15 #include "views/controls/menu/view_menu_delegate.h" 16 #include "views/controls/menu/view_menu_delegate.h"
16 17
17 namespace { 18 namespace {
18 19
19 const int kMainCommandIndexOffset = 1000; 20 const int kMainCommandIndexOffset = 1000;
20 const int kVPNCommandIndexOffset = 2000; 21 const int kVPNCommandIndexOffset = 2000;
21 const int kMoreCommandIndexOffset = 3000; 22 const int kMoreCommandIndexOffset = 3000;
22 23
23 } // namespace 24 } // namespace
24 25
25 class SkBitmap; 26 class SkBitmap;
26 27
27 namespace gfx { 28 namespace gfx {
28 class Canvas; 29 class Canvas;
29 } 30 }
30 31
31 namespace views { 32 namespace views {
33 class MenuButton;
34 class MenuItemInterface;
32 class MenuItemView; 35 class MenuItemView;
33 class MenuButton;
34 } 36 }
35 37
36 namespace chromeos { 38 namespace chromeos {
37 39
38 class NetworkMenuModel; 40 class NetworkMenuModel;
39 41
40 // Menu for network menu button in the status area/welcome screen. 42 // Menu for network menu button in the status area/welcome screen.
41 // This class will populating the menu with the list of networks. 43 // This class will populating the menu with the list of networks.
42 // It will also handle connecting to another wifi/cellular network. 44 // It will also handle connecting to another wifi/cellular network.
43 // 45 //
(...skipping 27 matching lines...) Expand all
71 class NetworkMenu { 73 class NetworkMenu {
72 public: 74 public:
73 class Delegate { 75 class Delegate {
74 public: 76 public:
75 virtual views::MenuButton* GetMenuButton() = 0; 77 virtual views::MenuButton* GetMenuButton() = 0;
76 virtual gfx::NativeWindow GetNativeWindow() const = 0; 78 virtual gfx::NativeWindow GetNativeWindow() const = 0;
77 virtual void OpenButtonOptions() = 0; 79 virtual void OpenButtonOptions() = 0;
78 virtual bool ShouldOpenButtonOptions() const = 0; 80 virtual bool ShouldOpenButtonOptions() const = 0;
79 }; 81 };
80 82
81 NetworkMenu(Delegate* delegate, bool is_browser_mode); 83 NetworkMenu(Delegate* delegate,
84 bool is_browser_mode,
85 views::MenuItemInterface* menu_item);
86
82 virtual ~NetworkMenu(); 87 virtual ~NetworkMenu();
83 88
84 // Cancels the active menu. 89 // Cancels the active menu.
85 void CancelMenu(); 90 void CancelMenu();
86 91
87 // Update the menu (e.g. when the network list or status has changed). 92 // Update the menu (e.g. when the network list or status has changed).
88 void UpdateMenu(); 93 void UpdateMenu();
89 94
90 // Run the menu.
91 void RunMenu(views::View* source);
92
93 // Shows network details in Web UI options window. 95 // Shows network details in Web UI options window.
94 void ShowTabbedNetworkSettings(const Network* network) const; 96 void ShowTabbedNetworkSettings(const Network* network) const;
95 97
96 // Getters. 98 // Getters.
97 Delegate* delegate() const { return delegate_; } 99 Delegate* delegate() const { return delegate_; }
98 bool is_browser_mode() const { return is_browser_mode_; } 100 bool is_browser_mode() const { return is_browser_mode_; }
99 101
100 // Setters. 102 protected:
101 void set_min_width(int min_width) { min_width_ = min_width; } 103 views::MenuDelegate* GetMenuDelegate();
104
105 // The network menu.
106 scoped_ptr<views::MenuItemInterface> menu_item_;
107 scoped_ptr<NetworkMenuModel> main_menu_model_;
102 108
103 private: 109 private:
104 friend class NetworkMenuModel; 110 friend class NetworkMenuModel;
105 111
106 // Weak ptr to delegate. 112 // Weak ptr to delegate.
107 Delegate* delegate_; 113 Delegate* delegate_;
108 114
109 // True if the browser is visible (i.e. not login/OOBE). 115 // True if the browser is visible (i.e. not login/OOBE).
110 bool is_browser_mode_; 116 bool is_browser_mode_;
111 117
112 // Set to true if we are currently refreshing the menu. 118 // Set to true if we are currently refreshing the menu.
113 bool refreshing_menu_; 119 bool refreshing_menu_;
114 120
115 // The network menu.
116 scoped_ptr<views::MenuItemView> menu_item_view_;
117 scoped_ptr<NetworkMenuModel> main_menu_model_;
118
119 // Holds minimum width of the menu.
120 int min_width_;
121
122 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); 121 DISALLOW_COPY_AND_ASSIGN(NetworkMenu);
123 }; 122 };
124 123
124 class NetworkMenuView : public NetworkMenu {
125 public:
126 NetworkMenuView(NetworkMenu::Delegate* delegate,
127 bool is_browser_mode);
128
129 virtual ~NetworkMenuView();
130
131 // Run the menu.
132 void RunMenu(views::View* source);
133
134 // Setters.
135 void set_min_width(int min_width) { min_width_ = min_width; }
136
137 private:
138 // This is a weak pointer to the MenuItemInterface implementation.
139 views::MenuItemView* menu_item_view_;
140
141 // Holds minimum width of the menu.
142 int min_width_;
143 };
144
125 } // namespace chromeos 145 } // namespace chromeos
126 146
127 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ 147 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698