blob: e4650a25877ba16d9de56dfeb0edfba0c935ba92 (
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
69
70
71
72
73
|
// 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_PASSWORD_DIALOG_VIEW_H_
#define CHROME_BROWSER_CHROMEOS_PASSWORD_DIALOG_VIEW_H_
#include <string>
#include "base/string16.h"
#include "views/window/dialog_delegate.h"
namespace views {
class Textfield;
class View;
class Window;
}
// Delegate implemented by caller of PasswordDialogView to handle the user
// interacting with the dialog box.
class PasswordDialogDelegate {
public:
// Called when user clicks on cancel button.
// Return whether or not to allow password dialog to close.
virtual bool OnPasswordDialogCancel() = 0;
// Called when user clicks on ok with a password.
// Return whether or not to allow password dialog to close.
virtual bool OnPasswordDialogAccept(const std::string& ssid,
const string16& password) = 0;
};
// A dialog box for showing a password textfield.
class PasswordDialogView : public views::View,
public views::DialogDelegate {
public:
explicit PasswordDialogView(PasswordDialogDelegate* delegate,
const std::string& ssid);
virtual ~PasswordDialogView() {}
// views::DialogDelegate methods.
virtual bool Cancel();
virtual bool Accept();
virtual std::wstring GetWindowTitle() const;
// views::WindowDelegate method.
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView() { return this; }
// views::View overrides.
virtual void Layout();
virtual gfx::Size GetPreferredSize();
protected:
virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
views::View* child);
private:
void Init();
// Used for call back to delegate that password has been entered.
PasswordDialogDelegate* delegate_;
// The ssid we are requesting the password for.
std::string ssid_;
// Combobox and its corresponding model.
views::Textfield* password_textfield_;
DISALLOW_COPY_AND_ASSIGN(PasswordDialogView);
};
#endif // CHROME_BROWSER_CHROMEOS_PASSWORD_DIALOG_VIEW_H_
|