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

Side by Side Diff: chrome/browser/ui/webui/md_feedback/md_feedback_ui.cc

Issue 2190653003: [Md Feedback] Add initial data population for dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per afakhry@'s comments (Rebase). Created 4 years, 3 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
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/browser_resources.h" 10 #include "chrome/grit/browser_resources.h"
10 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
11 #include "content/public/browser/web_ui_data_source.h" 12 #include "content/public/browser/web_ui_data_source.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
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", IDR_MD_FEEDBACK_FEEDBACK_JS);
54
51 // Polymer resources. 55 // Polymer resources.
52 html_source->AddResourcePath("feedback_container.html", 56 html_source->AddResourcePath("feedback_container.html",
53 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_HTML); 57 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_HTML);
54 html_source->AddResourcePath("feedback_container.js", 58 html_source->AddResourcePath("feedback_container.js",
55 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_JS); 59 IDR_MD_FEEDBACK_FEEDBACK_CONTAINER_JS);
56 60
57 html_source->SetJsonPath("strings.js"); 61 html_source->SetJsonPath("strings.js");
58 html_source->SetDefaultResource(IDR_MD_FEEDBACK_FEEDBACK_HTML); 62 html_source->SetDefaultResource(IDR_MD_FEEDBACK_FEEDBACK_HTML);
59 return html_source; 63 return html_source;
60 } 64 }
61 65
62 } // namespace 66 } // namespace
63 67
64 MdFeedbackUI::MdFeedbackUI(content::WebUI* web_ui) 68 MdFeedbackUI::MdFeedbackUI(content::WebUI* web_ui)
65 : content::WebUIController(web_ui) { 69 : content::WebUIController(web_ui), profile_(Profile::FromWebUI(web_ui)) {
66 // Set up the chrome://feedback data html_source. 70 // Set up the chrome://feedback data html_source.
67 Profile* profile = Profile::FromWebUI(web_ui);
68 content::WebUIDataSource* html_source = 71 content::WebUIDataSource* html_source =
69 CreateMdFeedbackUIHTMLSource(profile); 72 CreateMdFeedbackUIHTMLSource(profile_);
70 content::WebUIDataSource::Add(profile, html_source); 73 content::WebUIDataSource::Add(profile_, html_source);
74
75 web_ui->AddMessageHandler(new MdFeedbackWebUIMessageHandler(this));
71 } 76 }
72 77
73 MdFeedbackUI::~MdFeedbackUI() {} 78 MdFeedbackUI::~MdFeedbackUI() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698