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

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

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Removes strings from i18n file 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..caadcf5cd6beebb1968403aa5cf51d7154247bc5
--- /dev/null
+++ b/chrome/browser/ui/webui/webapks_ui.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2017 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/webapks_ui.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/webapks_handler.h"
+#include "chrome/common/url_constants.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"
pkotwicz 2017/01/19 19:37:18 I don't think that you need any of the includes on
gonzalon 2017/01/19 23:50:17 Done.
+#include "components/webapks_ui/webapks_ui_constants.h"
pkotwicz 2017/01/19 19:37:18 We are getting rid of the constants file so we sho
gonzalon 2017/01/19 23:50:17 Done.
+#include "content/public/browser/url_data_source.h"
pkotwicz 2017/01/19 19:37:17 I don't think that you need this include
gonzalon 2017/01/19 23:50:17 Done.
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
+
+using content::WebUIDataSource;
+
+namespace {
+
+WebUIDataSource* CreateWebApksUIDataSource() {
+ WebUIDataSource* html_source =
+ WebUIDataSource::Create(chrome::kChromeUIWebApksHost);
+ 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
pkotwicz 2017/01/19 19:37:18 Nit "namespace" -> "anonymous namespace"
gonzalon 2017/01/19 23:50:17 Done.
+
+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