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

Side by Side Diff: chrome/browser/ui/webui/input_window_dialog_webui.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_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
6 #define CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/ui/input_window_dialog.h" 13 #include "chrome/browser/ui/input_window_dialog.h"
14 #include "chrome/browser/ui/webui/html_dialog_ui.h" 14 #include "chrome/browser/ui/webui/html_dialog_ui.h"
15 15
16 namespace base { 16 namespace base {
17 class ListValue; 17 class ListValue;
18 } // namespace base 18 } // namespace base
19 19
20 class InputWindowDialogHandler; 20 class InputWindowDialogHandler;
21 21
22 // A class that implements InputWindowDialog methods with WebUI. 22 // A class that implements InputWindowDialog methods with WebUI.
23 class InputWindowDialogWebUI : public InputWindowDialog, 23 class InputWindowDialogWebUI : public InputWindowDialog,
24 private HtmlDialogUIDelegate { 24 private HtmlDialogUIDelegate {
25 public: 25 public:
26 InputWindowDialogWebUI(const string16& window_title, 26 InputWindowDialogWebUI(const string16& window_title,
27 const string16& label, 27 const LabelContentsPairs& label_contents_pairs,
28 const string16& contents, 28 InputWindowDialog::Delegate* delegate,
29 Delegate* delegate,
30 ButtonType type); 29 ButtonType type);
31 virtual ~InputWindowDialogWebUI(); 30 virtual ~InputWindowDialogWebUI();
32 31
33 // InputWindowDialog methods 32 // InputWindowDialog methods
34 virtual void Show() OVERRIDE; 33 virtual void Show() OVERRIDE;
35 virtual void Close() OVERRIDE; 34 virtual void Close() OVERRIDE;
36 35
37 private: 36 private:
38 // HtmlDialogUIDelegate methods 37 // HtmlDialogUIDelegate methods
39 virtual bool IsDialogModal() const OVERRIDE; 38 virtual bool IsDialogModal() const OVERRIDE;
40 virtual string16 GetDialogTitle() const OVERRIDE; 39 virtual string16 GetDialogTitle() const OVERRIDE;
41 virtual GURL GetDialogContentURL() const OVERRIDE; 40 virtual GURL GetDialogContentURL() const OVERRIDE;
42 virtual void GetWebUIMessageHandlers( 41 virtual void GetWebUIMessageHandlers(
43 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; 42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
44 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
45 virtual std::string GetDialogArgs() const OVERRIDE; 44 virtual std::string GetDialogArgs() const OVERRIDE;
46 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
47 virtual void OnCloseContents(TabContents* source, 46 virtual void OnCloseContents(TabContents* source,
48 bool* out_close_dialog) OVERRIDE; 47 bool* out_close_dialog) OVERRIDE;
49 virtual bool ShouldShowDialogTitle() const OVERRIDE; 48 virtual bool ShouldShowDialogTitle() const OVERRIDE;
50 49
51 // The dialog handler. 50 // The dialog handler.
52 InputWindowDialogHandler* handler_; 51 InputWindowDialogHandler* handler_;
53 52
54 string16 window_title_; 53 string16 window_title_;
55 string16 label_; 54 LabelContentsPairs label_contents_pairs_;
56 string16 contents_;
57 bool closed_; 55 bool closed_;
58 56
59 Delegate* delegate_; 57 Delegate* delegate_;
60 ButtonType type_; 58 ButtonType type_;
61 59
62 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogWebUI); 60 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogWebUI);
63 }; 61 };
64 62
65 // Dialog handler that handles calls from the JS WebUI code to validate the 63 // Dialog handler that handles calls from the JS WebUI code to validate the
66 // string value in the text field. 64 // string value in the text field.
67 class InputWindowDialogHandler : public WebUIMessageHandler { 65 class InputWindowDialogHandler : public WebUIMessageHandler {
68 public: 66 public:
69 explicit InputWindowDialogHandler(InputWindowDialog::Delegate* delegate); 67 explicit InputWindowDialogHandler(InputWindowDialog::Delegate* delegate);
70 68
71 void CloseDialog(); 69 void CloseDialog();
72 70
73 // Overridden from WebUIMessageHandler 71 // Overridden from WebUIMessageHandler
74 virtual void RegisterMessages(); 72 virtual void RegisterMessages();
75 73
76 private: 74 private:
77 void Validate(const base::ListValue* args); 75 void Validate(const base::ListValue* args);
78 76
79 InputWindowDialog::Delegate* delegate_; 77 InputWindowDialog::Delegate* delegate_;
80 78
81 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogHandler); 79 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogHandler);
82 }; 80 };
83 81
84 #endif // CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_ 82 #endif // CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698