| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h" | 5 #include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser_dialogs.h" | 7 #include "chrome/browser/ui/browser_dialogs.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/grit/generated_resources.h" |
| 9 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/web_dialogs/web_dialog_delegate.h" | 13 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 12 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 // The WebDialogDelegate that specifies what the MD Feedback dialog will look | 18 // The WebDialogDelegate that specifies what the MD Feedback dialog will look |
| 17 // like. | 19 // like. |
| 18 class MdFeedbackDialogDelegate : public ui::WebDialogDelegate { | 20 class MdFeedbackDialogDelegate : public ui::WebDialogDelegate { |
| 19 public: | 21 public: |
| 20 MdFeedbackDialogDelegate() {} | 22 MdFeedbackDialogDelegate() {} |
| 21 ~MdFeedbackDialogDelegate() override {} | 23 ~MdFeedbackDialogDelegate() override {} |
| 22 | 24 |
| 23 ui::ModalType GetDialogModalType() const override { | 25 ui::ModalType GetDialogModalType() const override { |
| 24 return ui::MODAL_TYPE_SYSTEM; | 26 return ui::MODAL_TYPE_SYSTEM; |
| 25 } | 27 } |
| 26 | 28 |
| 27 base::string16 GetDialogTitle() const override { | 29 base::string16 GetDialogTitle() const override { |
| 28 return base::string16(); | 30 return l10n_util::GetStringUTF16(IDS_MD_FEEDBACK_DIALOG_TITLE); |
| 29 } | 31 } |
| 30 | 32 |
| 31 GURL GetDialogContentURL() const override { | 33 GURL GetDialogContentURL() const override { |
| 32 return GURL(chrome::kChromeUIFeedbackURL); | 34 return GURL(chrome::kChromeUIFeedbackURL); |
| 33 } | 35 } |
| 34 | 36 |
| 35 void GetWebUIMessageHandlers( | 37 void GetWebUIMessageHandlers( |
| 36 std::vector<content::WebUIMessageHandler*>* handlers) const override {} | 38 std::vector<content::WebUIMessageHandler*>* handlers) const override {} |
| 37 | 39 |
| 38 void GetDialogSize(gfx::Size* size) const override { | 40 void GetDialogSize(gfx::Size* size) const override { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // TODO(apacible): Platform dependent implementations. | 75 // TODO(apacible): Platform dependent implementations. |
| 74 #if !defined(OS_MACOSX) | 76 #if !defined(OS_MACOSX) |
| 75 // TODO(apacible): If a feedback dialog is already open, bring that dialog | 77 // TODO(apacible): If a feedback dialog is already open, bring that dialog |
| 76 // to the front rather than creating a new dialog. | 78 // to the front rather than creating a new dialog. |
| 77 chrome::ShowWebDialog(nullptr, browser_context, | 79 chrome::ShowWebDialog(nullptr, browser_context, |
| 78 new MdFeedbackDialogDelegate()); | 80 new MdFeedbackDialogDelegate()); |
| 79 #endif // !defined(OS_MACOSX) | 81 #endif // !defined(OS_MACOSX) |
| 80 } | 82 } |
| 81 | 83 |
| 82 MdFeedbackDialogController::MdFeedbackDialogController() {} | 84 MdFeedbackDialogController::MdFeedbackDialogController() {} |
| OLD | NEW |