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

Side by Side Diff: athena/ui/athena_ui_main.cc

Issue 302683002: athena: Add the concept of Activity and related managers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/home/public/home_card.h" 5 #include "athena/home/public/home_card.h"
6 #include "athena/screen/public/screen_manager.h" 6 #include "athena/screen/public/screen_manager.h"
7 #include "athena/task/public/task_manager.h"
8 #include "athena/ui/sample_task.h"
7 #include "athena/wm/public/window_manager.h" 9 #include "athena/wm/public/window_manager.h"
8 #include "base/at_exit.h" 10 #include "base/at_exit.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/i18n/icu_util.h" 12 #include "base/i18n/icu_util.h"
11 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h"
12 #include "base/run_loop.h" 15 #include "base/run_loop.h"
13 #include "ui/aura/test/test_screen.h" 16 #include "ui/aura/test/test_screen.h"
14 #include "ui/aura/window_tree_host.h" 17 #include "ui/aura/window_tree_host.h"
15 #include "ui/base/ime/input_method_initializer.h" 18 #include "ui/base/ime/input_method_initializer.h"
19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/base/ui_base_paths.h"
16 #include "ui/compositor/compositor.h" 21 #include "ui/compositor/compositor.h"
17 #include "ui/compositor/test/context_factories_for_test.h" 22 #include "ui/compositor/test/context_factories_for_test.h"
18 #include "ui/gl/gl_surface.h" 23 #include "ui/gl/gl_surface.h"
19 #include "ui/wm/core/visibility_controller.h" 24 #include "ui/wm/core/visibility_controller.h"
20 #include "ui/wm/test/wm_test_helper.h" 25 #include "ui/wm/test/wm_test_helper.h"
21 26
22 class UIShell { 27 class UIShell {
23 public: 28 public:
24 UIShell() { 29 UIShell() {
25 InitScreen(); 30 InitScreen();
26 InitIME(); 31 InitIME();
27 InitWindow(); 32 InitWindow();
28 InitAthenaUI(); 33 InitAthenaUI();
34 InitSampleTasks();
29 } 35 }
30 36
31 void Show() { 37 void Show() {
32 wm_helper_->host()->Show(); 38 wm_helper_->host()->Show();
33 } 39 }
34 40
35 private: 41 private:
36 void InitScreen() { 42 void InitScreen() {
37 test_screen_.reset(aura::TestScreen::Create()); 43 test_screen_.reset(aura::TestScreen::Create());
38 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 44 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
(...skipping 13 matching lines...) Expand all
52 visibility_controller_.reset(new wm::VisibilityController()); 58 visibility_controller_.reset(new wm::VisibilityController());
53 aura::client::SetVisibilityClient(wm_helper_->host()->window(), 59 aura::client::SetVisibilityClient(wm_helper_->host()->window(),
54 visibility_controller_.get()); 60 visibility_controller_.get());
55 } 61 }
56 62
57 void InitAthenaUI() { 63 void InitAthenaUI() {
58 aura::Window* root = wm_helper_->host()->window(); 64 aura::Window* root = wm_helper_->host()->window();
59 athena::ScreenManager::Create(root); 65 athena::ScreenManager::Create(root);
60 athena::WindowManager::Create(); 66 athena::WindowManager::Create();
61 athena::HomeCard::Create(); 67 athena::HomeCard::Create();
68 athena::TaskManager::Create();
69 }
70
71 void InitSampleTasks() {
72 athena::Task* task =
73 new SampleTask(SK_ColorRED, SK_ColorGREEN, std::string("Task 1"));
74 athena::TaskManager::Get()->AddTask(task);
62 } 75 }
63 76
64 scoped_ptr<aura::TestScreen> test_screen_; 77 scoped_ptr<aura::TestScreen> test_screen_;
65 scoped_ptr<wm::WMTestHelper> wm_helper_; 78 scoped_ptr<wm::WMTestHelper> wm_helper_;
66 scoped_ptr<wm::VisibilityController> visibility_controller_; 79 scoped_ptr<wm::VisibilityController> visibility_controller_;
67 80
68 DISALLOW_COPY_AND_ASSIGN(UIShell); 81 DISALLOW_COPY_AND_ASSIGN(UIShell);
69 }; 82 };
70 83
71 int main(int argc, const char **argv) { 84 int main(int argc, const char **argv) {
72 setlocale(LC_ALL, ""); 85 setlocale(LC_ALL, "");
73 86
74 base::AtExitManager exit_manager; 87 base::AtExitManager exit_manager;
88 ui::RegisterPathProvider();
75 base::CommandLine::Init(argc, argv); 89 base::CommandLine::Init(argc, argv);
76 base::i18n::InitializeICU(); 90 base::i18n::InitializeICU();
77 gfx::GLSurface::InitializeOneOffForTests(); 91 gfx::GLSurface::InitializeOneOffForTests();
78 92
93 base::FilePath ui_test_pak_path;
94 DCHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
95 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
96
79 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); 97 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
80 (new UIShell())->Show(); 98 (new UIShell())->Show();
81 base::RunLoop run_loop; 99 base::RunLoop run_loop;
82 run_loop.Run(); 100 run_loop.Run();
83 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698