Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_UI_INPUT_WINDOW_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/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 enum ButtonType { | |
| 17 BT_ADD, | |
|
sky
2011/11/01 23:55:31
BT->BUTTON_TYPE_
tfarina
2011/11/02 00:05:42
Done.
| |
| 18 BT_SAVE, | |
| 19 }; | |
| 20 | |
| 16 class Delegate { | 21 class Delegate { |
| 17 public: | 22 public: |
| 18 virtual ~Delegate() {} | 23 virtual ~Delegate() {} |
| 19 | 24 |
| 20 // Checks whether |text| is a valid input string. | 25 // Checks whether |text| is a valid input string. |
| 21 virtual bool IsValid(const string16& text) = 0; | 26 virtual bool IsValid(const string16& text) = 0; |
| 22 | 27 |
| 23 // Callback for when the user clicks the OK button. | 28 // Callback for when the user clicks the OK button. |
| 24 virtual void InputAccepted(const string16& text) = 0; | 29 virtual void InputAccepted(const string16& text) = 0; |
| 25 | 30 |
| 26 // Callback for when the user clicks the Cancel button. | 31 // Callback for when the user clicks the Cancel button. |
| 27 virtual void InputCanceled() = 0; | 32 virtual void InputCanceled() = 0; |
| 28 }; | 33 }; |
| 29 | 34 |
| 30 // Creates a new input window dialog parented to |parent|. Ownership of | 35 // Creates a new input window dialog parented to |parent|. Ownership of |
| 31 // |delegate| is taken by InputWindowDialog or InputWindowDialog's owner. | 36 // |delegate| is taken by InputWindowDialog or InputWindowDialog's owner. |
| 32 static InputWindowDialog* Create(gfx::NativeWindow parent, | 37 static InputWindowDialog* Create(gfx::NativeWindow parent, |
| 33 const string16& window_title, | 38 const string16& window_title, |
| 34 const string16& label, | 39 const string16& label, |
| 35 const string16& contents, | 40 const string16& contents, |
| 36 Delegate* delegate); | 41 Delegate* delegate, |
| 42 ButtonType type); | |
| 37 | 43 |
| 38 // Displays the window. | 44 // Displays the window. |
| 39 virtual void Show() = 0; | 45 virtual void Show() = 0; |
| 40 | 46 |
| 41 // Closes the window. | 47 // Closes the window. |
| 42 virtual void Close() = 0; | 48 virtual void Close() = 0; |
| 43 | 49 |
| 44 protected: | 50 protected: |
| 45 InputWindowDialog() {} | 51 InputWindowDialog() {} |
| 46 virtual ~InputWindowDialog() {} | 52 virtual ~InputWindowDialog() {} |
| 47 | 53 |
| 48 private: | 54 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(InputWindowDialog); | 55 DISALLOW_COPY_AND_ASSIGN(InputWindowDialog); |
| 50 }; | 56 }; |
| 51 | 57 |
| 52 #endif // CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_ | 58 #endif // CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_ |
| OLD | NEW |