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

Side by Side Diff: chrome/browser/ui/webui/input_window_dialog_webui.h

Issue 8986007: Move WebUIMessageHandler to its own file in the public directory and put it in the content namesp... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months 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 | Annotate | Revision Log
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 #include "content/public/browser/web_ui_message_handler.h"
15 16
16 namespace base { 17 namespace base {
17 class ListValue; 18 class ListValue;
18 } // namespace base 19 } // namespace base
19 20
20 class InputWindowDialogHandler; 21 class InputWindowDialogHandler;
21 22
22 // A class that implements InputWindowDialog methods with WebUI. 23 // A class that implements InputWindowDialog methods with WebUI.
23 class InputWindowDialogWebUI : public InputWindowDialog, 24 class InputWindowDialogWebUI : public InputWindowDialog,
24 private HtmlDialogUIDelegate { 25 private HtmlDialogUIDelegate {
25 public: 26 public:
26 InputWindowDialogWebUI(const string16& window_title, 27 InputWindowDialogWebUI(const string16& window_title,
27 const LabelContentsPairs& label_contents_pairs, 28 const LabelContentsPairs& label_contents_pairs,
28 InputWindowDialog::Delegate* delegate, 29 InputWindowDialog::Delegate* delegate,
29 ButtonType type); 30 ButtonType type);
30 virtual ~InputWindowDialogWebUI(); 31 virtual ~InputWindowDialogWebUI();
31 32
32 // InputWindowDialog methods 33 // InputWindowDialog methods
33 virtual void Show() OVERRIDE; 34 virtual void Show() OVERRIDE;
34 virtual void Close() OVERRIDE; 35 virtual void Close() OVERRIDE;
35 36
36 private: 37 private:
37 // HtmlDialogUIDelegate methods 38 // HtmlDialogUIDelegate methods
38 virtual bool IsDialogModal() const OVERRIDE; 39 virtual bool IsDialogModal() const OVERRIDE;
39 virtual string16 GetDialogTitle() const OVERRIDE; 40 virtual string16 GetDialogTitle() const OVERRIDE;
40 virtual GURL GetDialogContentURL() const OVERRIDE; 41 virtual GURL GetDialogContentURL() const OVERRIDE;
41 virtual void GetWebUIMessageHandlers( 42 virtual void GetWebUIMessageHandlers(
42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; 43 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 44 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
44 virtual std::string GetDialogArgs() const OVERRIDE; 45 virtual std::string GetDialogArgs() const OVERRIDE;
45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 46 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
46 virtual void OnCloseContents(content::WebContents* source, 47 virtual void OnCloseContents(content::WebContents* source,
47 bool* out_close_dialog) OVERRIDE; 48 bool* out_close_dialog) OVERRIDE;
48 virtual bool ShouldShowDialogTitle() const OVERRIDE; 49 virtual bool ShouldShowDialogTitle() const OVERRIDE;
49 50
50 // The dialog handler. 51 // The dialog handler.
51 InputWindowDialogHandler* handler_; 52 InputWindowDialogHandler* handler_;
52 53
53 string16 window_title_; 54 string16 window_title_;
54 LabelContentsPairs label_contents_pairs_; 55 LabelContentsPairs label_contents_pairs_;
55 bool closed_; 56 bool closed_;
56 57
57 Delegate* delegate_; 58 Delegate* delegate_;
58 ButtonType type_; 59 ButtonType type_;
59 60
60 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogWebUI); 61 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogWebUI);
61 }; 62 };
62 63
63 // Dialog handler that handles calls from the JS WebUI code to validate the 64 // Dialog handler that handles calls from the JS WebUI code to validate the
64 // string value in the text field. 65 // string value in the text field.
65 class InputWindowDialogHandler : public WebUIMessageHandler { 66 class InputWindowDialogHandler : public content::WebUIMessageHandler {
66 public: 67 public:
67 explicit InputWindowDialogHandler(InputWindowDialog::Delegate* delegate); 68 explicit InputWindowDialogHandler(InputWindowDialog::Delegate* delegate);
68 69
69 void CloseDialog(); 70 void CloseDialog();
70 71
71 // Overridden from WebUIMessageHandler 72 // Overridden from WebUIMessageHandler
72 virtual void RegisterMessages() OVERRIDE; 73 virtual void RegisterMessages() OVERRIDE;
73 74
74 private: 75 private:
75 void Validate(const base::ListValue* args); 76 void Validate(const base::ListValue* args);
76 77
77 InputWindowDialog::Delegate* delegate_; 78 InputWindowDialog::Delegate* delegate_;
78 79
79 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogHandler); 80 DISALLOW_COPY_AND_ASSIGN(InputWindowDialogHandler);
80 }; 81 };
81 82
82 #endif // CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_ 83 #endif // CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/hung_renderer_dialog.cc ('k') | chrome/browser/ui/webui/input_window_dialog_webui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698