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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "athena/home/public/home_card.h"
6 #include "athena/screen/public/screen_manager.h"
7 #include "athena/wm/public/window_manager.h"
8 #include "base/at_exit.h"
9 #include "base/command_line.h"
10 #include "base/i18n/icu_util.h"
11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h"
13 #include "ui/aura/test/test_screen.h"
14 #include "ui/aura/window_tree_host.h"
15 #include "ui/base/ime/input_method_initializer.h"
16 #include "ui/compositor/compositor.h"
17 #include "ui/compositor/test/context_factories_for_test.h"
18 #include "ui/gl/gl_surface.h"
19 #include "ui/wm/core/visibility_controller.h"
20 #include "ui/wm/test/wm_test_helper.h"
21
22 class UIShell {
23 public:
24 UIShell() {
25 InitScreen();
26 InitIME();
27 InitWindow();
28 InitAthenaUI();
29 }
30
31 void Show() {
32 wm_helper_->host()->Show();
33 }
34
35 private:
36 void InitScreen() {
37 test_screen_.reset(aura::TestScreen::Create());
38 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
39 const bool enable_pixel_output = true;
40 ui::InitializeContextFactoryForTests(enable_pixel_output);
41 }
42
43 void InitIME() {
44 ui::InitializeInputMethodForTesting();
45 }
46
47 void InitWindow() {
48 const gfx::Size window_size(800, 600);
49 wm_helper_.reset(new wm::WMTestHelper(window_size,
50 ui::ContextFactory::GetInstance()));
51
52 visibility_controller_.reset(new wm::VisibilityController());
53 aura::client::SetVisibilityClient(wm_helper_->host()->window(),
54 visibility_controller_.get());
55 }
56
57 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.
58 aura::Window* root = wm_helper_->host()->window();
59 athena::ScreenManager::Create(root);
60 athena::WindowManager::Create();
61 athena::HomeCard::Create();
62 }
63
64 scoped_ptr<aura::TestScreen> test_screen_;
65 scoped_ptr<wm::WMTestHelper> wm_helper_;
66 scoped_ptr<wm::VisibilityController> visibility_controller_;
67
68 DISALLOW_COPY_AND_ASSIGN(UIShell);
69 };
70
71 int main(int argc, const char **argv) {
72 setlocale(LC_ALL, "");
73
74 base::AtExitManager exit_manager;
75 base::CommandLine::Init(argc, argv);
76 base::i18n::InitializeICU();
77 gfx::GLSurface::InitializeOneOffForTests();
78
79 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
80 (new UIShell())->Show();
81 base::RunLoop run_loop;
82 run_loop.Run();
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698