Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / chromeos / status / network_menu.h
blob76cd637a9cb8eafb0fff751089394d448dbb1c7a
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() = 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();
82 private:
83 friend class NetworkMenuModel;
85 // Getters.
86 Delegate* delegate() const { return delegate_; }
88 // Weak ptr to delegate.
89 Delegate* delegate_;
91 // Set to true if we are currently refreshing the menu.
92 bool refreshing_menu_;
94 // The network 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
99 // of this object.
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_