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

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: 'Address comments' 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..aed90d0f436f3355b94e073c06547c6bce9d143f
--- /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.
xiyuan 2011/10/18 16:11:32 nit: align with previous line.
mazda 2011/10/18 17:32:02 Done.
+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_

Powered by Google App Engine
This is Rietveld 408576698