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_
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
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
42 // The network menu model looks like this:
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 // --------------------------------
55 // --------------------------------
59 // <icon> will show the strength of the wifi/cellular networks.
60 // The label will be BOLD if the network is currently connected.
67 virtual gfx::NativeWindow
GetNativeWindow() const = 0;
68 virtual void OpenButtonOptions() = 0;
69 virtual bool ShouldOpenButtonOptions() const = 0;
70 virtual void OnConnectToNetworkRequested() = 0;
73 explicit NetworkMenu(Delegate
* delegate
);
74 virtual ~NetworkMenu();
76 // Access to menu definition.
77 ui::MenuModel
* GetMenuModel();
79 // Update the menu (e.g. when the network list or status has changed).
80 virtual void UpdateMenu();
83 friend class NetworkMenuModel
;
86 Delegate
* delegate() const { return delegate_
; }
88 // Weak ptr to delegate.
91 // Set to true if we are currently refreshing the menu.
92 bool refreshing_menu_
;
95 scoped_ptr
<NetworkMenuModel
> main_menu_model_
;
97 // Weak pointer factory so we can start connections at a later time
98 // without worrying that they will actually try to happen after the lifetime
100 base::WeakPtrFactory
<NetworkMenu
> weak_pointer_factory_
;
102 DISALLOW_COPY_AND_ASSIGN(NetworkMenu
);
105 } // namespace chromeos
107 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_