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

Unified Diff: athena/main/athena_shell.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
« no previous file with comments | « athena/main/athena_main.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/main/athena_shell.cc
diff --git a/athena/main/athena_shell.cc b/athena/main/athena_shell.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d54fc1a70e3be354612c2e8ab3f27b771503316
--- /dev/null
+++ b/athena/main/athena_shell.cc
@@ -0,0 +1,77 @@
+// 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/main/athena_launcher.h"
+#include "athena/screen/public/screen_manager.h"
+#include "athena/wm/public/window_manager.h"
oshima 2014/05/29 05:19:33 nit: I think you don't need home_card, screen_mana
sadrul 2014/05/30 02:29:48 Done.
+#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"
oshima 2014/05/29 05:19:33 optional: does it make sense to use athena/test/at
sadrul 2014/05/30 02:29:48 Done.
+
+class UIShell {
+ public:
+ UIShell() {
+ InitScreen();
+ InitIME();
+ InitWindow();
+ athena::StartAthena(wm_helper_->host()->window());
+ }
+
+ 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());
oshima 2014/05/29 14:54:23 one more nit. StartAthena does this, so you don't
sadrul 2014/05/30 02:29:48 Nice. Done.
+ }
+
+ 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();
+}
« no previous file with comments | « athena/main/athena_main.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698