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 "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/webui/webapks_handler.h" |
| 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/grit/chromium_strings.h" |
| 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/grit/components_resources.h" |
| 13 #include "components/strings/grit/components_chromium_strings.h" |
| 14 #include "components/strings/grit/components_strings.h" |
| 15 #include "components/webapks_ui/webapks_ui_constants.h" |
| 16 #include "content/public/browser/url_data_source.h" |
| 17 #include "content/public/browser/web_ui.h" |
| 18 #include "content/public/browser/web_ui_data_source.h" |
| 19 |
| 20 using content::WebUIDataSource; |
| 21 |
| 22 namespace { |
| 23 |
| 24 WebUIDataSource* CreateWebApksUIDataSource() { |
| 25 WebUIDataSource* html_source = |
| 26 WebUIDataSource::Create(chrome::kChromeUIWebApksHost); |
| 27 |
| 28 html_source->AddLocalizedString(webapks_ui::kTitle, IDS_WEBAPKS_UI_TITLE); |
| 29 html_source->AddLocalizedString(webapks_ui::kHeader, IDS_WEBAPKS_UI_HEADER); |
| 30 html_source->AddLocalizedString(webapks_ui::kPackageName, |
| 31 IDS_WEBAPKS_UI_PACKAGE_NAME); |
| 32 html_source->AddLocalizedString(webapks_ui::kShellApkVersion, |
| 33 IDS_WEBAPKS_UI_SHELL_APK_VERSION); |
| 34 html_source->AddLocalizedString(webapks_ui::kVersionCode, |
| 35 IDS_WEBAPKS_UI_VERSION_CODE); |
| 36 |
| 37 html_source->SetJsonPath("strings.js"); |
| 38 html_source->AddResourcePath(webapks_ui::kWebApksJS, IDR_WEBAPKS_UI_JS); |
| 39 html_source->AddResourcePath(webapks_ui::kAboutWebApksCSS, |
| 40 IDR_WEBAPKS_UI_CSS); |
| 41 html_source->SetDefaultResource(IDR_WEBAPKS_UI_HTML); |
| 42 |
| 43 return html_source; |
| 44 } |
| 45 |
| 46 } // namespace |
| 47 |
| 48 WebApksUI::WebApksUI(content::WebUI* web_ui) |
| 49 : content::WebUIController(web_ui) { |
| 50 Profile* profile = Profile::FromWebUI(web_ui); |
| 51 web_ui->AddMessageHandler(base::MakeUnique<WebApksHandler>()); |
| 52 WebUIDataSource::Add(profile, CreateWebApksUIDataSource()); |
| 53 } |
| 54 |
| 55 WebApksUI::~WebApksUI() {} |
OLD | NEW |