Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / options / wimax_config_view.h
blobfbe31a954f89d5d6d9f83dbd653bce5212f358f1
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_OPTIONS_WIMAX_CONFIG_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h"
14 #include "chrome/browser/chromeos/options/network_config_view.h"
15 #include "chrome/browser/chromeos/options/wifi_config_view.h"
16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/textfield/textfield_controller.h"
18 #include "ui/views/view.h"
20 namespace views {
21 class Checkbox;
22 class Label;
23 class ToggleImageButton;
26 namespace chromeos {
28 // A dialog box for showing a password textfield.
29 class WimaxConfigView : public ChildNetworkConfigView,
30 public views::TextfieldController,
31 public views::ButtonListener {
32 public:
33 // Configuration dialog for a WiMax network. If |service_path| is not empty
34 // it identifies the network to be configured.
35 WimaxConfigView(NetworkConfigView* parent, const std::string& service_path);
36 ~WimaxConfigView() override;
38 // views::TextfieldController:
39 void ContentsChanged(views::Textfield* sender,
40 const base::string16& new_contents) override;
41 bool HandleKeyEvent(views::Textfield* sender,
42 const ui::KeyEvent& key_event) override;
44 // views::ButtonListener:
45 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
47 // ChildNetworkConfigView:
48 base::string16 GetTitle() const override;
49 views::View* GetInitiallyFocusedView() override;
50 bool CanLogin() override;
51 bool Login() override;
52 void Cancel() override;
53 void InitFocus() override;
55 private:
56 // Initializes UI.
57 void Init();
59 // Callback to initialize fields from uncached network properties.
60 void InitFromProperties(const std::string& service_path,
61 const base::DictionaryValue& dictionary);
63 // Get input values.
64 std::string GetEapIdentity() const;
65 std::string GetEapPassphrase() const;
66 bool GetSaveCredentials() const;
67 bool GetShareNetwork(bool share_default) const;
69 // Updates state of the Login button.
70 void UpdateDialogButtons();
72 // Updates the error text label.
73 void UpdateErrorLabel();
75 NetworkPropertyUIData identity_ui_data_;
76 NetworkPropertyUIData passphrase_ui_data_;
77 NetworkPropertyUIData save_credentials_ui_data_;
79 views::Label* identity_label_;
80 views::Textfield* identity_textfield_;
81 views::Checkbox* save_credentials_checkbox_;
82 views::Checkbox* share_network_checkbox_;
83 views::Label* passphrase_label_;
84 views::Textfield* passphrase_textfield_;
85 views::ToggleImageButton* passphrase_visible_button_;
86 views::Label* error_label_;
88 base::WeakPtrFactory<WimaxConfigView> weak_ptr_factory_;
90 DISALLOW_COPY_AND_ASSIGN(WimaxConfigView);
93 } // namespace chromeos
95 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_