Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/hats/hats_ui.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/hats/hats_ui.cc b/chrome/browser/ui/webui/chromeos/hats/hats_ui.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5bfb67660064338341c955bb2a5fe4e8b24790d9 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/chromeos/hats/hats_ui.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/webui/chromeos/hats/hats_ui.h" |
| + |
| +#include "base/values.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/common/url_constants.h" |
| +#include "content/public/browser/web_ui.h" |
| +#include "content/public/browser/web_ui_data_source.h" |
| +#include "grit/browser_resources.h" |
| + |
| +using content::WebContents; |
| +using content::WebUIMessageHandler; |
| + |
| +namespace chromeos { |
| + |
| +HatsUI::HatsUI(content::WebUI* web_ui) |
| + : WebDialogUI(web_ui) { |
| + content::WebUIDataSource* source = |
| + content::WebUIDataSource::Create(chrome::kChromeUIHatsHost); |
| + |
| + source->SetDefaultResource(IDR_HATS_HTML); |
| + source->DisableContentSecurityPolicy(); |
| + |
| + web_ui->RegisterMessageCallback("surveyCompleted", |
| + 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.
|
| + |
| + 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
|
| + content::WebUIDataSource::Add(profile, source); |
| +} |
| + |
| +HatsUI::~HatsUI() {} |
| + |
| +void HatsUI::SurveyCompleted(const base::ListValue* args) { |
| + CloseDialog(args); |
| +} |
| + |
| +} // namespace chromeos |