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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h"
6
7 #include "chrome/browser/ui/browser_dialogs.h"
8 #include "chrome/common/url_constants.h"
9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/web_contents.h"
11 #include "ui/web_dialogs/web_dialog_delegate.h"
12 #include "url/gurl.h"
13
14 namespace {
15
16 // The WebDialogDelegate that specifies what the MD Feedback dialog will look
17 // like.
18 class MdFeedbackDialogDelegate : public ui::WebDialogDelegate {
19 public:
20 MdFeedbackDialogDelegate() {}
21 ~MdFeedbackDialogDelegate() override {}
22
23 ui::ModalType GetDialogModalType() const override {
24 return ui::MODAL_TYPE_SYSTEM;
25 }
26
27 base::string16 GetDialogTitle() const override {
28 return base::string16();
29 }
30
31 GURL GetDialogContentURL() const override {
32 return GURL(chrome::kChromeUIFeedbackURL);
33 }
34
35 void GetWebUIMessageHandlers(
36 std::vector<content::WebUIMessageHandler*>* handlers) const override {}
37
38 void GetDialogSize(gfx::Size* size) const override {
39 // TODO(apacible): Update when WebUI sizing behavior is finalized.
40 size->SetSize(400, 600);
41 }
42
43 std::string GetDialogArgs() const override {
44 return std::string();
45 }
46
47 void OnDialogClosed(const std::string& json_retval) override {
48 delete this;
49 }
50
51 void OnCloseContents(
52 content::WebContents* source, bool* out_close_dialog) override {}
53
54 bool ShouldShowDialogTitle() const override {
55 return false;
56 }
57
58 bool HandleContextMenu(const content::ContextMenuParams& params) override {
59 // Do not show the contextual menu.
60 return true;
61 }
62 };
63
64 } // namespace
65
66 // static
67 MdFeedbackDialogController* MdFeedbackDialogController::GetInstance() {
68 return base::Singleton<MdFeedbackDialogController>::get();
69 }
70
71 void MdFeedbackDialogController::Show(
72 content::BrowserContext* browser_context) {
73 // TODO(apacible): Platform dependent implementations.
74 #if !defined(OS_MACOSX)
75 // TODO(apacible): If a feedback dialog is already open, bring that dialog
76 // to the front rather than creating a new dialog.
77 chrome::ShowWebDialog(nullptr, browser_context,
78 new MdFeedbackDialogDelegate());
79 #endif // !defined(OS_MACOSX)
80 }
81
82 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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698