• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_HANDLER_H_
7 
8 #include <string>
9 
10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h"
12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
13 #include "chrome/browser/ui/webui/chromeos/login/network_dropdown.h"
14 
15 namespace chromeos {
16 
17 class NetworkDropdownHandler : public BaseScreenHandler,
18                                public NetworkDropdown::Actor {
19  public:
20   class Observer {
21    public:
~Observer()22     virtual ~Observer() {}
23     virtual void OnConnectToNetworkRequested() = 0;
24   };
25 
26   NetworkDropdownHandler();
27   virtual ~NetworkDropdownHandler();
28 
29   void AddObserver(Observer* observer);
30   void RemoveObserver(Observer* observer);
31 
32   // BaseScreenHandler implementation:
33   virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE;
34   virtual void Initialize() OVERRIDE;
35 
36   // WebUIMessageHandler implementation:
37   virtual void RegisterMessages() OVERRIDE;
38 
39  private:
40   // NetworkDropdown::Actor implementation:
41   virtual void OnConnectToNetworkRequested() OVERRIDE;
42 
43   // Handles choosing of the network menu item.
44   void HandleNetworkItemChosen(double id);
45   // Handles network drop-down showing.
46   void HandleNetworkDropdownShow(const std::string& element_id,
47                                  bool oobe);
48   // Handles network drop-down hiding.
49   void HandleNetworkDropdownHide();
50   // Handles network drop-down refresh.
51   void HandleNetworkDropdownRefresh();
52 
53   scoped_ptr<NetworkDropdown> dropdown_;
54 
55   ObserverList<Observer> observers_;
56 
57   DISALLOW_COPY_AND_ASSIGN(NetworkDropdownHandler);
58 };
59 
60 }  // namespace chromeos
61 #endif  // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_HANDLER_H_
62