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

Side by Side 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, 6 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 MdFeedbackDialogController::MdFeedbackDialogController() {}
67
68 MdFeedbackDialogController::~MdFeedbackDialogController() {}
69
70 // static
71 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
72 // TODO(apacible): If there is already an existing controller for the browser
73 // profile, reuse it.
74 return new MdFeedbackDialogController();
75 }
76
77 void MdFeedbackDialogController::Show(
78 content::BrowserContext* browser_context) {
79 // TODO(apacible): Platform dependent implementations.
80 #if !defined(OS_MACOSX)
81 // TODO(apacible): If a feedback dialog is already open, bring that dialog
82 // to the front rather than creating a new dialog.
83 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
84 #endif
85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698