Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / status / network_menu.h
blob99897820976a51e22ea8a0265ea39d16cc7bc25c
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h"
14 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow
16 class Browser;
18 namespace ui {
19 class MenuModel;
22 namespace views {
23 class MenuItemView;
24 class MenuButton;
25 class MenuRunner;
28 namespace chromeos {
30 class NetworkMenuModel;
32 // This class builds and manages a ui::MenuModel used to build network
33 // menus. It does not represent an actual menu widget. The menu is populated
34 // with the list of wifi and mobile networks, and handles connecting to
35 // existing networks or spawning UI to configure a new network.
37 // This class is now only used to build the dropdown menu in the oobe and
38 // other web based login screen UI. See ash::NetworkStateListDetailedView for
39 // the status area network list. TODO(stevenjb): Integrate this with the
40 // login UI code.
42 // The network menu model looks like this:
44 // <icon> Ethernet
45 // <icon> Wifi Network A
46 // <icon> Wifi Network B
47 // <icon> Wifi Network C
48 // <icon> Cellular Network A
49 // <icon> Cellular Network B
50 // <icon> Cellular Network C
51 // <icon> Other Wi-Fi network...
52 // --------------------------------
53 // Disable Wifi
54 // Disable Celluar
55 // --------------------------------
56 // <IP Address>
57 // Proxy settings...
59 // <icon> will show the strength of the wifi/cellular networks.
60 // The label will be BOLD if the network is currently connected.
62 class NetworkMenu {
63 public:
64 class Delegate {
65 public:
66 virtual ~Delegate();
67 virtual gfx::NativeWindow GetNativeWindow() const = 0;
68 virtual void OpenButtonOptions() = 0;
69 virtual bool ShouldOpenButtonOptions() const = 0;
70 virtual void OnConnectToNetworkRequested(
71 const std::string& service_path) = 0;
74 explicit NetworkMenu(Delegate* delegate);
75 virtual ~NetworkMenu();
77 // Access to menu definition.
78 ui::MenuModel* GetMenuModel();
80 // Update the menu (e.g. when the network list or status has changed).
81 virtual void UpdateMenu();
83 private:
84 friend class NetworkMenuModel;
86 // Getters.
87 Delegate* delegate() const { return delegate_; }
89 // Weak ptr to delegate.
90 Delegate* delegate_;
92 // Set to true if we are currently refreshing the menu.
93 bool refreshing_menu_;
95 // The network menu.
96 scoped_ptr<NetworkMenuModel> main_menu_model_;
98 // Weak pointer factory so we can start connections at a later time
99 // without worrying that they will actually try to happen after the lifetime
100 // of this object.
101 base::WeakPtrFactory<NetworkMenu> weak_pointer_factory_;
103 DISALLOW_COPY_AND_ASSIGN(NetworkMenu);
106 } // namespace chromeos
108 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_