diff options
Diffstat (limited to 'chrome/browser/chromeos/login/network_screen.h')
-rw-r--r-- | chrome/browser/chromeos/login/network_screen.h | 94 |
1 files changed, 34 insertions, 60 deletions
diff --git a/chrome/browser/chromeos/login/network_screen.h b/chrome/browser/chromeos/login/network_screen.h index e7d00cb..860e901 100644 --- a/chrome/browser/chromeos/login/network_screen.h +++ b/chrome/browser/chromeos/login/network_screen.h @@ -4,14 +4,16 @@ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_NETWORK_SCREEN_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_NETWORK_SCREEN_H_ +#pragma once -#include <string> - +#include "base/scoped_ptr.h" +#include "base/string16.h" #include "base/task.h" #include "base/timer.h" #include "chrome/browser/chromeos/cros/network_library.h" -#include "chrome/browser/chromeos/login/network_screen_delegate.h" #include "chrome/browser/chromeos/login/language_switch_menu.h" +#include "chrome/browser/chromeos/login/message_bubble.h" +#include "chrome/browser/chromeos/login/network_screen_delegate.h" #include "chrome/browser/chromeos/login/view_screen.h" #include "chrome/browser/chromeos/network_list.h" #include "chrome/browser/chromeos/options/network_config_view.h" @@ -20,39 +22,28 @@ class WizardScreenDelegate; namespace chromeos { +class HelpAppLauncher; class NetworkSelectionView; class NetworkScreen : public ViewScreen<NetworkSelectionView>, - public NetworkScreenDelegate, - public NetworkConfigView::Delegate { + public MessageBubbleDelegate, + public NetworkScreenDelegate { public: - NetworkScreen(WizardScreenDelegate* delegate, bool is_out_of_box); + explicit NetworkScreen(WizardScreenDelegate* delegate); virtual ~NetworkScreen(); // NetworkScreenDelegate implementation: + virtual void ClearErrors(); virtual LanguageSwitchMenu* language_switch_menu() { return &language_switch_menu_; } - - // ComboboxModel implementation: - virtual int GetItemCount(); - virtual std::wstring GetItemAt(int index); - - // views::Combobox::Listener implementation: - virtual void ItemChanged(views::Combobox* sender, - int prev_index, - int new_index); + virtual gfx::Size size() const { return GetScreenSize(); } // views::ButtonListener implementation: virtual void ButtonPressed(views::Button* sender, const views::Event& event); // NetworkLibrary::Observer implementation: virtual void NetworkChanged(NetworkLibrary* network_lib); - virtual void NetworkTraffic(NetworkLibrary* cros, int traffic_type) {} - - // NetworkConfigView::Delegate implementation: - virtual void OnDialogAccepted(); - virtual void OnDialogCancelled(); protected: // Subscribes NetworkScreen to the network change notification, @@ -60,15 +51,18 @@ class NetworkScreen : public ViewScreen<NetworkSelectionView>, void Refresh(); private: + FRIEND_TEST(NetworkScreenTest, Timeout); + // ViewScreen implementation: virtual void CreateView(); virtual NetworkSelectionView* AllocateView(); - // Connects to network if needed and updates screen state. - void ConnectToNetwork(NetworkList::NetworkType type, const string16& id); - - // Enables WiFi device. - void EnableWiFi(); + // Overridden from views::InfoBubbleDelegate. + virtual void InfoBubbleClosing(InfoBubble* info_bubble, + bool closed_by_escape) { bubble_ = NULL; } + virtual bool CloseOnEscape() { return true; } + virtual bool FadeInOnShow() { return false; } + virtual void OnHelpLinkActivated(); // Subscribes to network change notifications. void SubscribeNetworkNotification(); @@ -76,63 +70,43 @@ class NetworkScreen : public ViewScreen<NetworkSelectionView>, // Unsubscribes from network change notifications. void UnsubscribeNetworkNotification(); - // Returns currently selected network in the combobox. - NetworkList::NetworkItem* GetSelectedNetwork(); - // Notifies wizard on successful connection. void NotifyOnConnection(); // Called by |connection_timer_| when connection to the network timed out. void OnConnectionTimeout(); - // Opens password dialog for the encrypted networks. - void OpenPasswordDialog(WifiNetwork network); - - // Selects network by type and id. - void SelectNetwork(NetworkList::NetworkType type, - const string16& id); - - // Switches connecting status based on |is_waiting_for_connect_|. - void ShowConnectingStatus(); + // Update UI based on current network status. + void UpdateStatus(NetworkLibrary* network); // Stops waiting for network to connect. - // If |show_combobox| is false, spinner is left on screen. Used on exit. - void StopWaitingForConnection(bool show_combobox); + void StopWaitingForConnection(const string16& network_id); // Starts waiting for network connection. Shows spinner. - void WaitForConnection(const NetworkList::NetworkItem* network); + void WaitForConnection(const string16& network_id); // True if subscribed to network change notification. bool is_network_subscribed_; - // Networks model, contains current state of available networks. - NetworkList networks_; - - // True if WiFi is currently disabled. - bool wifi_disabled_; - - // True if full OOBE flow should be shown. - bool is_out_of_box_; - - // True if we're waiting for the selected network being connected. - bool is_waiting_for_connect_; + // ID of the the network that we are waiting for. + string16 network_id_; - // True if "Continue" button was pressed. - // Set only when there's a network selected. + // True if user pressed continue button so we should proceed with OOBE + // as soon as we are connected. bool continue_pressed_; - // True if Ethernet was already preselected in combobox. - bool ethernet_preselected_; - // Timer for connection timeout. base::OneShotTimer<NetworkScreen> connection_timer_; - // Network which we're connecting to. - NetworkList::NetworkItem connecting_network_; - - ScopedRunnableMethodFactory<NetworkScreen> task_factory_; LanguageSwitchMenu language_switch_menu_; + // Pointer to shown message bubble. We don't need to delete it because + // it will be deleted on bubble closing. + MessageBubble* bubble_; + + // Help application used for help dialogs. + scoped_ptr<HelpAppLauncher> help_app_; + DISALLOW_COPY_AND_ASSIGN(NetworkScreen); }; |