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

Unified Diff: chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc

Issue 2021753005: [MD Feedback] Add basic chrome://feedback dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per imcheng@'s comments. Created 4 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/md_feedback/md_feedback_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc
diff --git a/chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc b/chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc
index c6ee03764c590458f78f81496486abdde53b0ddf..5afb358f1e221f40a63f9f9cf1cc82114f3e3cbd 100644
--- a/chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc
+++ b/chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc
@@ -6,8 +6,68 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
+#include "ui/web_dialogs/web_dialog_delegate.h"
+#include "url/gurl.h"
+
+#if !defined(OS_MACOSX)
+#include "chrome/browser/ui/browser_dialogs.h"
+#endif
+
+namespace {
+
+// The WebDialogDelegate that specifies what the MD Feedback dialog will look
+// like.
+class MdFeedbackDialogDelegate : public ui::WebDialogDelegate {
+ public:
+ MdFeedbackDialogDelegate() {}
+ ~MdFeedbackDialogDelegate() override {}
+
+ ui::ModalType GetDialogModalType() const override {
+ return ui::MODAL_TYPE_SYSTEM;
+ }
+
+ base::string16 GetDialogTitle() const override {
+ return base::string16();
+ }
+
+ GURL GetDialogContentURL() const override {
+ return GURL(chrome::kChromeUIFeedbackURL);
+ }
+
+ void GetWebUIMessageHandlers(
+ std::vector<content::WebUIMessageHandler*>* handlers) const override {}
+
+ void GetDialogSize(gfx::Size* size) const override {
+ // TODO(apacible): Update when WebUI sizing behavior is finalized.
+ size->SetSize(400, 600);
+ }
+
+ std::string GetDialogArgs() const override {
+ return std::string();
+ }
+
+ void OnDialogClosed(const std::string& json_retval) override {
+ delete this;
+ }
+
+ void OnCloseContents(
+ content::WebContents* source, bool* out_close_dialog) override {}
+
+ bool ShouldShowDialogTitle() const override {
+ return false;
+ }
+
+ bool HandleContextMenu(const content::ContextMenuParams& params) override {
+ // Do not show the contextual menu.
+ return true;
+ }
+};
+
+} // namespace
MdFeedbackUI::MdFeedbackUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
@@ -19,3 +79,13 @@ MdFeedbackUI::MdFeedbackUI(content::WebUI* web_ui)
}
MdFeedbackUI::~MdFeedbackUI() {}
+
+void ShowFeedbackWebDialog(
+ content::BrowserContext* browser_context) {
+ // TODO(apacible): Platform dependent implementations.
+#if !defined(OS_MACOSX)
+ // TODO(apacible): If a feedback dialog is already open, bring that dialog
+ // to the front rather than creating a new dialog.
+ chrome::ShowWebDialog(NULL, browser_context, new MdFeedbackDialogDelegate());
+#endif // !OS_MACOSX
+}
« no previous file with comments | « chrome/browser/ui/webui/md_feedback/md_feedback_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698