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