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

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

Issue 2021753005: [MD Feedback] Add basic chrome://feedback dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.cc
diff --git a/chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.cc b/chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b8a8b048edae43b484e1d9b8bf9066b0a1f8a028
--- /dev/null
+++ b/chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.cc
@@ -0,0 +1,85 @@
+// Copyright 2016 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.
+
+#include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h"
+
+#include "chrome/browser/ui/browser_dialogs.h"
+#include "chrome/common/url_constants.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/web_contents.h"
+#include "ui/web_dialogs/web_dialog_delegate.h"
+#include "url/gurl.h"
+
+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
+
+MdFeedbackDialogController::MdFeedbackDialogController() {}
+
+MdFeedbackDialogController::~MdFeedbackDialogController() {}
+
+// static
+MdFeedbackDialogController* MdFeedbackDialogController::GetOrCreate() {
imcheng 2016/06/02 04:19:10 For now I do not see a need for the MdFeedbackDial
apacible 2016/06/02 18:04:20 Per offline conversation: - Removed MdFeedbackDial
+ // TODO(apacible): If there is already an existing controller for the browser
+ // profile, reuse it.
+ return new MdFeedbackDialogController();
+}
+
+void MdFeedbackDialogController::Show(
+ 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());
imcheng 2016/06/02 04:19:10 Is the intention that at most one feedback UI dial
apacible 2016/06/02 18:04:20 Correct, at most one feedback UI dialog can be ope
+#endif
+}

Powered by Google App Engine
This is Rietveld 408576698