OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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/chromeos/hats/hats_ui.h" | |
6 | |
7 #include "base/values.h" | |
8 #include "chrome/browser/profiles/profile.h" | |
9 #include "chrome/common/url_constants.h" | |
10 #include "content/public/browser/web_ui.h" | |
11 #include "content/public/browser/web_ui_data_source.h" | |
12 #include "grit/browser_resources.h" | |
13 | |
14 using content::WebContents; | |
15 using content::WebUIMessageHandler; | |
16 | |
17 namespace chromeos { | |
18 | |
19 HatsUI::HatsUI(content::WebUI* web_ui) | |
20 : WebDialogUI(web_ui) { | |
21 content::WebUIDataSource* source = | |
22 content::WebUIDataSource::Create(chrome::kChromeUIHatsHost); | |
23 | |
24 source->SetDefaultResource(IDR_HATS_HTML); | |
25 source->DisableContentSecurityPolicy(); | |
26 | |
27 web_ui->RegisterMessageCallback("surveyCompleted", | |
28 base::Bind(&HatsUI::SurveyCompleted, base::Unretained(this))); | |
stevenjb
2016/06/10 01:08:16
We should at least add a "complete survey" button
malaykeshav
2016/06/10 01:18:32
Done. Removing for this CL.
| |
29 | |
30 Profile* profile = Profile::FromWebUI(web_ui); | |
stevenjb
2016/06/10 01:08:16
No need for local
malaykeshav
2016/06/10 01:18:32
Done
| |
31 content::WebUIDataSource::Add(profile, source); | |
32 } | |
33 | |
34 HatsUI::~HatsUI() {} | |
35 | |
36 void HatsUI::SurveyCompleted(const base::ListValue* args) { | |
37 CloseDialog(args); | |
38 } | |
39 | |
40 } // namespace chromeos | |
OLD | NEW |