| OLD | NEW |
| (Empty) |
| 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_CHROMEOS_LOGIN_NETWORK_SELECTION_VIEW_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_NETWORK_SELECTION_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/string16.h" | |
| 13 #include "chrome/browser/chromeos/login/login_html_dialog.h" | |
| 14 #include "chrome/browser/chromeos/views/dropdown_button.h" | |
| 15 #include "views/controls/link_listener.h" | |
| 16 #include "views/view.h" | |
| 17 | |
| 18 namespace gfx { | |
| 19 class Size; | |
| 20 } // namespace gfx | |
| 21 | |
| 22 namespace views { | |
| 23 class Combobox; | |
| 24 class GridLayout; | |
| 25 class Label; | |
| 26 class NativeTextButton; | |
| 27 class Throbber; | |
| 28 } // namespace views | |
| 29 | |
| 30 namespace chromeos { | |
| 31 | |
| 32 class NetworkDropdownButton; | |
| 33 class ScreenObserver; | |
| 34 class ViewsNetworkScreenActor; | |
| 35 | |
| 36 // View for the network selection/initial welcome screen. | |
| 37 class NetworkSelectionView : public views::View, | |
| 38 public views::LinkListener, | |
| 39 public LoginHtmlDialog::Delegate { | |
| 40 public: | |
| 41 explicit NetworkSelectionView(ViewsNetworkScreenActor* actor); | |
| 42 virtual ~NetworkSelectionView(); | |
| 43 | |
| 44 // Initialize view layout. | |
| 45 void Init(); | |
| 46 | |
| 47 // Update strings from the resources. Executed on language change. | |
| 48 void UpdateLocalizedStringsAndFonts(); | |
| 49 | |
| 50 // Returns top level native window for the view. | |
| 51 gfx::NativeWindow GetNativeWindow() const; | |
| 52 | |
| 53 // Returns network control view. | |
| 54 views::View* GetNetworkControlView() const; | |
| 55 | |
| 56 // Shows network connecting status or network selection otherwise. | |
| 57 void ShowConnectingStatus(bool connecting, const string16& network_id); | |
| 58 | |
| 59 // Returns true if only throbber is visible, the view is in waiting status. | |
| 60 bool IsConnecting() const; | |
| 61 | |
| 62 // Sets whether continue control is enabled. | |
| 63 void EnableContinue(bool enabled); | |
| 64 | |
| 65 // Returns whether continue button is enabled. | |
| 66 bool IsContinueEnabled() const; | |
| 67 | |
| 68 // views::LinkListener implementation. | |
| 69 virtual void LinkClicked(views::Link* source, int) OVERRIDE; | |
| 70 | |
| 71 // Returns true if any dialog box is currently open? | |
| 72 bool is_dialog_open() const { | |
| 73 return proxy_settings_dialog_.get() && proxy_settings_dialog_->is_open(); | |
| 74 } | |
| 75 | |
| 76 protected: | |
| 77 // Overridden from views::View. | |
| 78 virtual bool OnKeyPressed(const views::KeyEvent& e); | |
| 79 virtual void OnLocaleChanged(); | |
| 80 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e); | |
| 81 | |
| 82 // LoginHtmlDialog::Delegate implementation: | |
| 83 virtual void OnDialogClosed() {} | |
| 84 | |
| 85 private: | |
| 86 // Add screen controls to the contents layout specified. | |
| 87 // Based on state (connecting to the network or not) | |
| 88 // different controls are added. | |
| 89 void AddControlsToLayout(views::GridLayout* contents_layout); | |
| 90 | |
| 91 // Initializes grid layout of the screen. Called on language change too. | |
| 92 void InitLayout(); | |
| 93 | |
| 94 // Delete and recreate native controls that | |
| 95 // fail to update preferred size after string update. | |
| 96 void RecreateNativeControls(); | |
| 97 | |
| 98 // Updates text on label with currently connecting network. | |
| 99 void UpdateConnectingNetworkLabel(); | |
| 100 | |
| 101 // View that defines FillLayout for the whole screen (contents & title). | |
| 102 views::View* entire_screen_view_; | |
| 103 | |
| 104 // View that contains screen contents (except title). | |
| 105 views::View* contents_view_; | |
| 106 | |
| 107 // Screen controls. | |
| 108 DropDownButton* languages_menubutton_; | |
| 109 DropDownButton* keyboards_menubutton_; | |
| 110 views::Label* welcome_label_; | |
| 111 views::Label* select_language_label_; | |
| 112 views::Label* select_keyboard_label_; | |
| 113 views::Label* select_network_label_; | |
| 114 views::Label* connecting_network_label_; | |
| 115 NetworkDropdownButton* network_dropdown_; | |
| 116 views::NativeTextButton* continue_button_; | |
| 117 views::Throbber* throbber_; | |
| 118 views::Link* proxy_settings_link_; | |
| 119 bool show_keyboard_button_; | |
| 120 | |
| 121 ViewsNetworkScreenActor* actor_; | |
| 122 | |
| 123 // Id of the network that is in process of connecting. | |
| 124 string16 network_id_; | |
| 125 | |
| 126 // Dialog used for to launch proxy settings. | |
| 127 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; | |
| 128 | |
| 129 DISALLOW_COPY_AND_ASSIGN(NetworkSelectionView); | |
| 130 }; | |
| 131 | |
| 132 } // namespace chromeos | |
| 133 | |
| 134 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_NETWORK_SELECTION_VIEW_H_ | |
| OLD | NEW |