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

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

Issue 2159323003: [MD Feedback] Add placeholder feedback entry point. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per afakhry@'s comments. Created 4 years, 4 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..d866afb8fa72f1b9e9fbb895a7326e49ff0e269c
--- /dev/null
+++ b/chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.cc
@@ -0,0 +1,82 @@
+// 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
+
+// static
+MdFeedbackDialogController* MdFeedbackDialogController::GetInstance() {
+ return base::Singleton<MdFeedbackDialogController>::get();
+}
+
+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(nullptr, browser_context,
+ new MdFeedbackDialogDelegate());
+#endif // !defined(OS_MACOSX)
+}
+
+MdFeedbackDialogController::MdFeedbackDialogController() {}
afakhry 2016/08/11 20:44:39 apacible, I just noticed you didn't remove this im
apacible 2016/08/11 20:56:22 Ah, I only wrote = default for the destructor and

Powered by Google App Engine
This is Rietveld 408576698