OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_INPUT_WINDOW_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_INPUT_WINDOW_DIALOG_H_ |
6 #define CHROME_BROWSER_INPUT_WINDOW_DIALOG_H_ | 6 #define CHROME_BROWSER_INPUT_WINDOW_DIALOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
12 | 12 |
13 // Cross platform access to a modal input window. | 13 // Cross platform access to a modal input window. |
14 class InputWindowDialog { | 14 class InputWindowDialog { |
15 public: | 15 public: |
16 class Delegate { | 16 class Delegate { |
17 public: | 17 public: |
18 virtual ~Delegate() {} | 18 virtual ~Delegate() { } |
19 | 19 |
20 // Checks whether |text| is a valid input string. | 20 // Checks whether |text| is a valid input string. |
21 virtual bool IsValid(const std::wstring& text) = 0; | 21 virtual bool IsValid(const std::wstring& text) = 0; |
22 | 22 |
23 // Callback for when the user clicks the OK button. | 23 // Callback for when the user clicks the OK button. |
24 virtual void InputAccepted(const std::wstring& text) = 0; | 24 virtual void InputAccepted(const std::wstring& text) = 0; |
25 | 25 |
26 // Callback for when the user clicks the Cancel button. | 26 // Callback for when the user clicks the Cancel button. |
27 virtual void InputCanceled() = 0; | 27 virtual void InputCanceled() = 0; |
28 }; | 28 }; |
29 | 29 |
30 // Creates a new input window dialog parented to |parent|. Ownership of | 30 // Creates a new input window dialog parented to |parent|. Ownership of |
31 // |delegate| is taken by InputWindowDialog or InputWindowDialog's owner. | 31 // |delegate| is taken by InputWindowDialog or InputWindowDialog's owner. |
32 static InputWindowDialog* Create(gfx::NativeView parent, | 32 static InputWindowDialog* Create(gfx::NativeView parent, |
33 const std::wstring& window_title, | 33 const std::wstring& window_title, |
34 const std::wstring& label, | 34 const std::wstring& label, |
35 const std::wstring& contents, | 35 const std::wstring& contents, |
36 Delegate* delegate); | 36 Delegate* delegate); |
37 | 37 |
38 // Displays the window. | 38 // Displays the window. |
39 virtual void Show() = 0; | 39 virtual void Show() = 0; |
40 | 40 |
41 // Closes the window. | 41 // Closes the window. |
42 virtual void Close() = 0; | 42 virtual void Close() = 0; |
43 | 43 |
44 protected: | 44 protected: |
45 InputWindowDialog() {} | 45 InputWindowDialog() { } |
46 ~InputWindowDialog() {} | |
47 | 46 |
48 private: | 47 private: |
49 DISALLOW_COPY_AND_ASSIGN(InputWindowDialog); | 48 DISALLOW_COPY_AND_ASSIGN(InputWindowDialog); |
50 }; | 49 }; |
51 | 50 |
52 #endif // CHROME_BROWSER_INPUT_WINDOW_DIALOG_H_ | 51 #endif // CHROME_BROWSER_INPUT_WINDOW_DIALOG_H_ |
OLD | NEW |