Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5344)

Unified Diff: chrome/browser/ui/webui/webapks_ui.cc

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds an about:webapks page with information about all installed Web APKs on the device Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/webapks_ui.cc
diff --git a/chrome/browser/ui/webui/webapks_ui.cc b/chrome/browser/ui/webui/webapks_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..451ffcf2d397467c84882f4b0b9bc937ab641558
--- /dev/null
+++ b/chrome/browser/ui/webui/webapks_ui.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
hartmanng 2017/01/13 15:40:21 s/(c) 2012/2017/
gonzalon 2017/01/13 20:24:39 Done.
+// 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/webapks_ui.h"
+
+#include "base/android/build_info.h"
hartmanng 2017/01/13 15:40:21 lots of includes again, you might be able to remov
gonzalon 2017/01/13 20:24:39 Done.
+#include "base/i18n/message_formatter.h"
+#include "build/build_config.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/android/android_about_app_info.h"
+#include "chrome/browser/ui/webui/webapks_handler.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/chromium_strings.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/grit/components_resources.h"
+#include "components/strings/grit/components_chromium_strings.h"
+#include "components/strings/grit/components_strings.h"
+#include "components/webapks_ui/webapks_ui_constants.h"
+#include "content/public/browser/url_data_source.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "ui/base/l10n/l10n_util.h"
+
+using content::WebUIDataSource;
+
+namespace {
+
+WebUIDataSource* CreateWebAPKsUIDataSource() {
+ WebUIDataSource* html_source =
+ WebUIDataSource::Create(chrome::kChromeUIWebAPKsHost);
+
+ html_source->AddLocalizedString(webapks_ui::kTitle, IDS_WEBAPKS_UI_TITLE);
+ html_source->AddLocalizedString(webapks_ui::kHeader, IDS_WEBAPKS_UI_HEADER);
+ html_source->AddLocalizedString(webapks_ui::kPackageName,
+ IDS_WEBAPKS_UI_PACKAGE_NAME);
+ html_source->AddLocalizedString(webapks_ui::kShellApkVersion,
+ IDS_WEBAPKS_UI_SHELL_APK_VERSION);
+ html_source->AddLocalizedString(webapks_ui::kVersionCode,
+ IDS_WEBAPKS_UI_VERSION_CODE);
+
+ html_source->SetJsonPath("strings.js");
+ html_source->AddResourcePath(webapks_ui::kWebAPKsJS, IDR_WEBAPKS_UI_JS);
+ html_source->AddResourcePath(webapks_ui::kAboutWebAPKsCSS,
+ IDR_WEBAPKS_UI_CSS);
+ html_source->SetDefaultResource(IDR_WEBAPKS_UI_HTML);
+
+ return html_source;
+}
+
+} // namespace
+
+WebAPKsUI::WebAPKsUI(content::WebUI* web_ui)
+ : content::WebUIController(web_ui) {
+ Profile* profile = Profile::FromWebUI(web_ui);
+ web_ui->AddMessageHandler(base::MakeUnique<WebAPKsHandler>());
+ WebUIDataSource::Add(profile, CreateWebAPKsUIDataSource());
+}
+
+WebAPKsUI::~WebAPKsUI() {}

Powered by Google App Engine
This is Rietveld 408576698