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