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

Unified Diff: mandoline/ui/aura/aura_init.cc

Issue 1123643007: Restore aura support from Mojo repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 8 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 | « mandoline/ui/aura/aura_init.h ('k') | mandoline/ui/aura/input_method_mojo_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/ui/aura/aura_init.cc
diff --git a/mandoline/ui/aura/aura_init.cc b/mandoline/ui/aura/aura_init.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f14a477a98e1cee4db60a3b5ac41b6c1325ff714
--- /dev/null
+++ b/mandoline/ui/aura/aura_init.cc
@@ -0,0 +1,62 @@
+// 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 "mandoline/ui/aura/aura_init.h"
+
+#include "base/i18n/icu_util.h"
+#include "base/lazy_instance.h"
+#include "base/path_service.h"
+#include "mandoline/ui/aura/screen_mojo.h"
+#include "ui/aura/env.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/ui_base_paths.h"
+
+namespace mandoline {
+namespace {
+
+// Used to ensure we only init once.
+class Setup {
+ public:
+ Setup() {
+ base::i18n::InitializeICU();
+
+ ui::RegisterPathProvider();
+
+ base::FilePath ui_test_pak_path;
+ CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
+ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
+
+ // There is a bunch of static state in gfx::Font, by running this now,
+ // before any other apps load, we ensure all the state is set up.
+ gfx::Font();
+ }
+
+ ~Setup() {
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Setup);
+};
+
+static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+void InitViews() {
+ setup.Get();
+}
+
+AuraInit::AuraInit() {
+ aura::Env::CreateInstance(false);
+
+ screen_.reset(ScreenMojo::Create());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
+
+ InitViews();
+}
+
+AuraInit::~AuraInit() {
+}
+
+} // namespace mandoline
« no previous file with comments | « mandoline/ui/aura/aura_init.h ('k') | mandoline/ui/aura/input_method_mojo_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698