Chromium Code Reviews| 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_ui.h" | 5 #include "chrome/browser/ui/webui/md_feedback/md_feedback_ui.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/webui/md_feedback/md_feedback_webui_message_handler. h" | |
| 8 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 10 #include "content/public/browser/web_ui_data_source.h" | 11 #include "content/public/browser/web_ui_data_source.h" |
| 11 #include "grit/browser_resources.h" | 12 #include "grit/browser_resources.h" |
| 12 | 13 |
| 13 #if !defined(OS_MACOSX) | 14 #if !defined(OS_MACOSX) |
| 14 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 15 #endif | 16 #endif |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 41 IDS_MD_FEEDBACK_CANCEL_BUTTON); | 42 IDS_MD_FEEDBACK_CANCEL_BUTTON); |
| 42 html_source->AddLocalizedString("sendReportButton", | 43 html_source->AddLocalizedString("sendReportButton", |
| 43 IDS_MD_FEEDBACK_SEND_REPORT_BUTTON); | 44 IDS_MD_FEEDBACK_SEND_REPORT_BUTTON); |
| 44 | 45 |
| 45 // Checkbox labels. | 46 // Checkbox labels. |
| 46 html_source->AddLocalizedString("includeScreenshotLabel", | 47 html_source->AddLocalizedString("includeScreenshotLabel", |
| 47 IDS_MD_FEEDBACK_SCREENSHOT_LABEL); | 48 IDS_MD_FEEDBACK_SCREENSHOT_LABEL); |
| 48 html_source->AddLocalizedString("sendSystemInfoLabel", | 49 html_source->AddLocalizedString("sendSystemInfoLabel", |
| 49 IDS_MD_FEEDBACK_SEND_SYSTEM_INFO_LABEL); | 50 IDS_MD_FEEDBACK_SEND_SYSTEM_INFO_LABEL); |
| 50 | 51 |
| 52 // File resources. | |
| 53 html_source->AddResourcePath("feedback.js", | |
| 54 IDR_MD_FEEDBACK_FEEDBACK_JS); | |
| 55 | |
| 51 // Polymer resources. | 56 // Polymer resources. |
| 52 html_source->AddResourcePath("feedback_container.html", | 57 html_source->AddResourcePath("feedback_container.html", |
| 53 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_HTML); | 58 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_HTML); |
| 54 html_source->AddResourcePath("feedback_container.js", | 59 html_source->AddResourcePath("feedback_container.js", |
| 55 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_JS); | 60 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_JS); |
| 56 | 61 |
| 57 html_source->SetJsonPath("strings.js"); | 62 html_source->SetJsonPath("strings.js"); |
| 58 html_source->SetDefaultResource(IDR_MD_FEEDBACK_FEEDBACK_HTML); | 63 html_source->SetDefaultResource(IDR_MD_FEEDBACK_FEEDBACK_HTML); |
| 59 return html_source; | 64 return html_source; |
| 60 } | 65 } |
| 61 | 66 |
| 62 } // namespace | 67 } // namespace |
| 63 | 68 |
| 64 MdFeedbackUI::MdFeedbackUI(content::WebUI* web_ui) | 69 MdFeedbackUI::MdFeedbackUI(content::WebUI* web_ui) |
| 65 : content::WebUIController(web_ui) { | 70 : content::WebUIController(web_ui) { |
| 66 // Set up the chrome://feedback data html_source. | 71 // Set up the chrome://feedback data html_source. |
| 67 Profile* profile = Profile::FromWebUI(web_ui); | 72 Profile* profile = Profile::FromWebUI(web_ui); |
| 68 content::WebUIDataSource* html_source = | 73 content::WebUIDataSource* html_source = |
| 69 CreateMdFeedbackUIHTMLSource(profile); | 74 CreateMdFeedbackUIHTMLSource(profile); |
| 70 content::WebUIDataSource::Add(profile, html_source); | 75 content::WebUIDataSource::Add(profile, html_source); |
| 76 | |
| 77 MdFeedbackWebUIMessageHandler* handler = | |
| 78 new MdFeedbackWebUIMessageHandler(this); | |
| 79 web_ui->AddMessageHandler(handler); | |
|
afakhry
2016/08/11 23:31:31
Since we won't use |handler| at all, how about thi
apacible
2016/08/12 01:46:41
Done.
| |
| 71 } | 80 } |
| 72 | 81 |
| 73 MdFeedbackUI::~MdFeedbackUI() {} | 82 MdFeedbackUI::~MdFeedbackUI() {} |
| OLD | NEW |