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

Unified Diff: chrome/browser/ui/webui/input_window_dialog_webui.h

Issue 8298019: Implement InputWindowDialog with WebUI for bookmark folder management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/input_window_dialog_webui.h
diff --git a/chrome/browser/ui/webui/input_window_dialog_webui.h b/chrome/browser/ui/webui/input_window_dialog_webui.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0f3d5f8337d191b1ceaf9acc491f9c101b849dd
--- /dev/null
+++ b/chrome/browser/ui/webui/input_window_dialog_webui.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
+#define CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/string16.h"
+#include "chrome/browser/ui/input_window_dialog.h"
+#include "chrome/browser/ui/webui/html_dialog_ui.h"
+
+namespace base {
+class ListValue;
+} // namespace base
+
+class InputWindowDialogHandler;
+
+// A class that implements InputWindowDialog methods with WebUI.
+class InputWindowDialogWebUI : public InputWindowDialog,
+ private HtmlDialogUIDelegate {
+ public:
+ InputWindowDialogWebUI(const string16& window_title,
+ const string16& label,
+ const string16& contents,
+ InputWindowDialog::Delegate* delegate);
+ virtual ~InputWindowDialogWebUI();
+
+ // InputWindowDialog methods
+ virtual void Show() OVERRIDE;
+ virtual void Close() OVERRIDE;
+
+ private:
+ // HtmlDialogUIDelegate methods
+ virtual bool IsDialogModal() const OVERRIDE;
+ virtual string16 GetDialogTitle() const OVERRIDE;
+ virtual GURL GetDialogContentURL() const OVERRIDE;
+ virtual void GetWebUIMessageHandlers(
+ std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
+ virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
+ virtual std::string GetDialogArgs() const OVERRIDE;
+ virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
+ virtual void OnCloseContents(TabContents* source,
+ bool* out_close_dialog) OVERRIDE;
+ virtual bool ShouldShowDialogTitle() const OVERRIDE;
+
+ // The dialog handler.
+ InputWindowDialogHandler* handler_;
+
+ string16 window_title_;
+ string16 label_;
+ string16 contents_;
+ bool closed_;
+
+ InputWindowDialog::Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(InputWindowDialogWebUI);
+};
+
+// Dialog handler that handles calls from the JS WebUI code to validate the
+// string value in the text field.
+class InputWindowDialogHandler : public WebUIMessageHandler {
+ public:
+ explicit InputWindowDialogHandler(InputWindowDialog::Delegate* delegate);
+
+ void CloseDialog();
+
+ // Overridden from WebUIMessageHandler
+ virtual void RegisterMessages();
+
+ private:
+ void Validate(const base::ListValue* args);
+
+ InputWindowDialog::Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(InputWindowDialogHandler);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_INPUT_WINDOW_DIALOG_WEBUI_H_
« no previous file with comments | « chrome/browser/ui/webui/input_window_dialog_ui.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