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

Unified Diff: athena/ui/athena_ui_main.cc

Issue 302473005: athena: Add a minimal executable for just the UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: athena/ui/athena_ui_main.cc
diff --git a/athena/ui/athena_ui_main.cc b/athena/ui/athena_ui_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..badcfc4dc82a21508078492da9d1267eb7df0cbd
--- /dev/null
+++ b/athena/ui/athena_ui_main.cc
@@ -0,0 +1,83 @@
+// Copyright 2014 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 "athena/home/public/home_card.h"
+#include "athena/screen/public/screen_manager.h"
+#include "athena/wm/public/window_manager.h"
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/i18n/icu_util.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "ui/aura/test/test_screen.h"
+#include "ui/aura/window_tree_host.h"
+#include "ui/base/ime/input_method_initializer.h"
+#include "ui/compositor/compositor.h"
+#include "ui/compositor/test/context_factories_for_test.h"
+#include "ui/gl/gl_surface.h"
+#include "ui/wm/core/visibility_controller.h"
+#include "ui/wm/test/wm_test_helper.h"
+
+class UIShell {
+ public:
+ UIShell() {
+ InitScreen();
+ InitIME();
+ InitWindow();
+ InitAthenaUI();
+ }
+
+ void Show() {
+ wm_helper_->host()->Show();
+ }
+
+ private:
+ void InitScreen() {
+ test_screen_.reset(aura::TestScreen::Create());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
+ const bool enable_pixel_output = true;
+ ui::InitializeContextFactoryForTests(enable_pixel_output);
+ }
+
+ void InitIME() {
+ ui::InitializeInputMethodForTesting();
+ }
+
+ void InitWindow() {
+ const gfx::Size window_size(800, 600);
+ wm_helper_.reset(new wm::WMTestHelper(window_size,
+ ui::ContextFactory::GetInstance()));
+
+ visibility_controller_.reset(new wm::VisibilityController());
+ aura::client::SetVisibilityClient(wm_helper_->host()->window(),
+ visibility_controller_.get());
+ }
+
+ void InitAthenaUI() {
sadrul 2014/05/26 18:53:01 Does it make sense to move this into some other pl
oshima 2014/05/27 18:32:14 You can use athena_launcher once it's landed. htt
sadrul 2014/05/29 03:03:56 Done.
+ aura::Window* root = wm_helper_->host()->window();
+ athena::ScreenManager::Create(root);
+ athena::WindowManager::Create();
+ athena::HomeCard::Create();
+ }
+
+ scoped_ptr<aura::TestScreen> test_screen_;
+ scoped_ptr<wm::WMTestHelper> wm_helper_;
+ scoped_ptr<wm::VisibilityController> visibility_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(UIShell);
+};
+
+int main(int argc, const char **argv) {
+ setlocale(LC_ALL, "");
+
+ base::AtExitManager exit_manager;
+ base::CommandLine::Init(argc, argv);
+ base::i18n::InitializeICU();
+ gfx::GLSurface::InitializeOneOffForTests();
+
+ base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
+ (new UIShell())->Show();
+ base::RunLoop run_loop;
+ run_loop.Run();
+}

Powered by Google App Engine
This is Rietveld 408576698