OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2017 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/webapks_ui.h" | |
6 | |
7 #include <string> | |
pkotwicz
2017/01/20 16:57:17
Nit: You should also include unordered_set
gonzalon
2017/01/20 19:27:01
Done.
| |
8 | |
9 #include "chrome/browser/profiles/profile.h" | |
10 #include "chrome/browser/ui/webui/webapks_handler.h" | |
11 #include "chrome/common/url_constants.h" | |
12 #include "chrome/grit/generated_resources.h" | |
13 #include "components/grit/components_resources.h" | |
14 #include "content/public/browser/web_ui.h" | |
15 #include "content/public/browser/web_ui_data_source.h" | |
16 | |
17 using content::WebUIDataSource; | |
18 | |
19 namespace { | |
20 | |
21 WebUIDataSource* CreateWebApksUIDataSource() { | |
22 WebUIDataSource* html_source = | |
23 WebUIDataSource::Create(chrome::kChromeUIWebApksHost); | |
24 html_source->SetJsonPath("strings.js"); | |
25 html_source->AddResourcePath("webapks.js", IDR_WEBAPKS_UI_JS); | |
26 html_source->AddResourcePath("about_webapks.css", IDR_WEBAPKS_UI_CSS); | |
27 html_source->SetDefaultResource(IDR_WEBAPKS_UI_HTML); | |
28 html_source->UseGzip(std::unordered_set<std::string>()); | |
29 | |
30 return html_source; | |
31 } | |
32 | |
33 } // anonymous namespace | |
34 | |
35 WebApksUI::WebApksUI(content::WebUI* web_ui) | |
36 : content::WebUIController(web_ui) { | |
37 Profile* profile = Profile::FromWebUI(web_ui); | |
38 web_ui->AddMessageHandler(base::MakeUnique<WebApksHandler>()); | |
39 WebUIDataSource::Add(profile, CreateWebApksUIDataSource()); | |
40 } | |
41 | |
42 WebApksUI::~WebApksUI() {} | |
OLD | NEW |