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

Unified Diff: ui/oobe/oobe_md_ui.cc

Issue 941973003: New OOBE implementation skeleton using WUG toolkit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No explicit, gn format. Created 5 years, 10 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
« no previous file with comments | « ui/oobe/oobe_md_ui.h ('k') | ui/oobe/oobe_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/oobe/oobe_md_ui.cc
diff --git a/ui/oobe/oobe_md_ui.cc b/ui/oobe/oobe_md_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..07e91b59931d1ded0a1e93c3eaacce06526bfa37
--- /dev/null
+++ b/ui/oobe/oobe_md_ui.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 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 "base/strings/string_util.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "grit/oobe_resources.h"
+#include "grit/oobe_resources_map.h"
+#include "ui/oobe/declarations/oobe_web_ui_view.h"
+#include "ui/oobe/oobe_md_ui.h"
+
+namespace {
+
+void SetUpDataSource(content::WebUIDataSource* source) {
+ source->SetJsonPath("strings.js");
+ source->AddResourcePath("", IDR_OOBE_UI_HTML);
+
+ // Add all resources defined in "oobe_resources.grd" file at once.
+ const char prefix[] = "resources/";
+ const size_t prefix_length = arraysize(prefix) - 1;
+ for (size_t i = 0; i < kOobeResourcesSize; ++i) {
+ std::string name = kOobeResources[i].name;
+ DCHECK(StartsWithASCII(name, prefix, true));
+ source->AddResourcePath(name.substr(prefix_length),
+ kOobeResources[i].value);
+ }
+}
+
+} // namespace
+
+OobeMdUI::OobeMdUI(content::WebUI* web_ui, const std::string& host)
+ : WebUIController(web_ui) {
+ content::WebUIDataSource* source = content::WebUIDataSource::Create(host);
+ SetUpDataSource(source);
+
+ view_.reset(new gen::OobeWebUIView(web_ui));
+ view_->Init();
+ view_->SetUpDataSource(source);
+
+ content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
+ source);
+}
+
+OobeMdUI::~OobeMdUI() {}
« no previous file with comments | « ui/oobe/oobe_md_ui.h ('k') | ui/oobe/oobe_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698