Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: chrome/browser/ui/input_window_dialog.h

Issue 8438037: Change 'Add Page' to show a simple input dialog with --use-more-webui. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector>
10
9 #include "base/basictypes.h" 11 #include "base/basictypes.h"
10 #include "base/string16.h" 12 #include "base/string16.h"
11 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
12 14
13 // Cross platform access to a modal input window. 15 // Cross platform access to a modal input window.
14 class InputWindowDialog { 16 class InputWindowDialog {
15 public: 17 public:
16 enum ButtonType { 18 enum ButtonType {
17 BUTTON_TYPE_ADD, 19 BUTTON_TYPE_ADD,
18 BUTTON_TYPE_SAVE, 20 BUTTON_TYPE_SAVE,
19 }; 21 };
22 typedef std::vector<std::pair<string16, string16> > LabelContentsPairs;
23 typedef std::vector<string16> InputTexts;
20 24
21 class Delegate { 25 class Delegate {
22 public: 26 public:
23 virtual ~Delegate() {} 27 virtual ~Delegate() {}
24 28
25 // Checks whether |text| is a valid input string. 29 // Checks whether |text| is a valid input string.
26 virtual bool IsValid(const string16& text) = 0; 30 virtual bool IsValid(const InputTexts& texts) = 0;
27 31
28 // Callback for when the user clicks the OK button. 32 // Callback for when the user clicks the OK button.
29 virtual void InputAccepted(const string16& text) = 0; 33 virtual void InputAccepted(const InputTexts& texts) = 0;
30 34
31 // Callback for when the user clicks the Cancel button. 35 // Callback for when the user clicks the Cancel button.
32 virtual void InputCanceled() = 0; 36 virtual void InputCanceled() = 0;
33 }; 37 };
34 38
35 // Creates a new input window dialog parented to |parent|. Ownership of 39 // Creates a new input window dialog parented to |parent|. Ownership of
36 // |delegate| is taken by InputWindowDialog or InputWindowDialog's owner. 40 // |delegate| is taken by InputWindowDialog or InputWindowDialog's owner.
37 static InputWindowDialog* Create(gfx::NativeWindow parent, 41 static InputWindowDialog* Create(
38 const string16& window_title, 42 gfx::NativeWindow parent,
39 const string16& label, 43 const string16& window_title,
40 const string16& contents, 44 const LabelContentsPairs& label_contents_pairs,
41 Delegate* delegate, 45 Delegate* delegate,
42 ButtonType type); 46 ButtonType type);
43 47
44 // Displays the window. 48 // Displays the window.
45 virtual void Show() = 0; 49 virtual void Show() = 0;
46 50
47 // Closes the window. 51 // Closes the window.
48 virtual void Close() = 0; 52 virtual void Close() = 0;
49 53
50 protected: 54 protected:
51 InputWindowDialog() {} 55 InputWindowDialog() {}
52 virtual ~InputWindowDialog() {} 56 virtual ~InputWindowDialog() {}
53 57
54 private: 58 private:
55 DISALLOW_COPY_AND_ASSIGN(InputWindowDialog); 59 DISALLOW_COPY_AND_ASSIGN(InputWindowDialog);
56 }; 60 };
57 61
58 #endif // CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_ 62 #endif // CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc ('k') | chrome/browser/ui/input_window_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698