summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/options/wifi_config_view.h
blob: dda8f9f154ac9567593c42aa3f9387d70636189b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_
#define CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_

#include <string>

#include "base/string16.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "views/controls/textfield/textfield.h"
#include "views/view.h"

namespace chromeos {

class NetworkConfigView;

// A dialog box for showing a password textfield.
class WifiConfigView : public views::View,
                       public views::Textfield::Controller {
 public:
  WifiConfigView(NetworkConfigView* parent, WifiNetwork wifi);
  explicit WifiConfigView(NetworkConfigView* parent);
  virtual ~WifiConfigView() {}

  // views::Textfield::Controller methods.
  virtual void ContentsChanged(views::Textfield* sender,
                               const string16& new_contents);
  virtual bool HandleKeystroke(views::Textfield* sender,
                               const views::Textfield::Keystroke& keystroke) {
    return false;
  }

  // Get the typed in ssid.
  const string16& GetSSID() const;
  // Get the typed in passphrase.
  const string16& GetPassphrase() const;

  // Returns true if the textfields are non-empty and we can login.
  bool can_login() const { return can_login_; }

  // Focus the first field in the UI.
  void FocusFirstField();

 private:
  // Initializes UI.
  void Init();

  NetworkConfigView* parent_;

  bool other_network_;

  // Whether or not we can log in. This gets recalculated when textfield
  // contents change.
  bool can_login_;

  WifiNetwork wifi_;

  views::Textfield* ssid_textfield_;
  views::Textfield* passphrase_textfield_;

  DISALLOW_COPY_AND_ASSIGN(WifiConfigView);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_