OLD | NEW |
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/main/athena_launcher.h" | 5 #include "athena/main/athena_launcher.h" |
6 | 6 |
7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
9 #include "athena/content/public/app_registry.h" | 9 #include "athena/content/public/app_registry.h" |
10 #include "athena/content/public/content_activity_factory.h" | 10 #include "athena/content/public/content_activity_factory.h" |
11 #include "athena/content/public/content_app_model_builder.h" | 11 #include "athena/content/public/content_app_model_builder.h" |
| 12 #include "athena/env/public/athena_env.h" |
12 #include "athena/extensions/public/extensions_delegate.h" | 13 #include "athena/extensions/public/extensions_delegate.h" |
13 #include "athena/home/public/home_card.h" | 14 #include "athena/home/public/home_card.h" |
14 #include "athena/home/public/home_card.h" | 15 #include "athena/home/public/home_card.h" |
15 #include "athena/input/public/input_manager.h" | 16 #include "athena/input/public/input_manager.h" |
16 #include "athena/main/debug/debug_window.h" | 17 #include "athena/main/debug/debug_window.h" |
17 #include "athena/main/placeholder.h" | 18 #include "athena/main/placeholder.h" |
18 #include "athena/main/placeholder.h" | 19 #include "athena/main/placeholder.h" |
19 #include "athena/main/url_search_provider.h" | 20 #include "athena/main/url_search_provider.h" |
20 #include "athena/screen/public/screen_manager.h" | 21 #include "athena/screen/public/screen_manager.h" |
21 #include "athena/screen/public/screen_manager.h" | 22 #include "athena/screen/public/screen_manager.h" |
22 #include "athena/system/public/system_ui.h" | 23 #include "athena/system/public/system_ui.h" |
23 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h" | 24 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h" |
24 #include "athena/wm/public/window_manager.h" | 25 #include "athena/wm/public/window_manager.h" |
25 #include "base/command_line.h" | 26 #include "base/command_line.h" |
26 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
27 #include "ui/app_list/app_list_switches.h" | 28 #include "ui/app_list/app_list_switches.h" |
28 #include "ui/aura/window_property.h" | 29 #include "ui/aura/window_property.h" |
| 30 #include "ui/aura/window_tree_host.h" |
29 #include "ui/keyboard/keyboard_controller.h" | 31 #include "ui/keyboard/keyboard_controller.h" |
30 #include "ui/keyboard/keyboard_controller_observer.h" | 32 #include "ui/keyboard/keyboard_controller_observer.h" |
31 #include "ui/native_theme/native_theme_switches.h" | 33 #include "ui/native_theme/native_theme_switches.h" |
32 #include "ui/views/views_delegate.h" | 34 #include "ui/views/views_delegate.h" |
33 #include "ui/wm/core/visibility_controller.h" | 35 #include "ui/wm/core/visibility_controller.h" |
34 | 36 |
35 #if defined(USE_X11) | 37 #if defined(USE_X11) |
36 #include "ui/events/x/touch_factory_x11.h" | 38 #include "ui/events/x/touch_factory_x11.h" |
37 #endif | 39 #endif |
38 | 40 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 private: | 87 private: |
86 // views::ViewsDelegate: | 88 // views::ViewsDelegate: |
87 virtual void OnBeforeWidgetInit( | 89 virtual void OnBeforeWidgetInit( |
88 views::Widget::InitParams* params, | 90 views::Widget::InitParams* params, |
89 views::internal::NativeWidgetDelegate* delegate) OVERRIDE { | 91 views::internal::NativeWidgetDelegate* delegate) OVERRIDE { |
90 } | 92 } |
91 | 93 |
92 DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegate); | 94 DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegate); |
93 }; | 95 }; |
94 | 96 |
95 void StartAthenaEnv(aura::Window* root_window, | 97 void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner) { |
96 athena::ScreenManagerDelegate* delegate, | 98 athena::AthenaEnv::Create(); |
97 scoped_refptr<base::TaskRunner> file_runner) { | 99 |
98 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 100 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
99 | 101 |
100 // Force showing in the experimental app-list view. | 102 // Force showing in the experimental app-list view. |
101 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList); | 103 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList); |
102 command_line->AppendSwitch(switches::kEnableOverlayScrollbar); | 104 command_line->AppendSwitch(switches::kEnableOverlayScrollbar); |
103 | 105 |
104 #if defined(USE_X11) | 106 #if defined(USE_X11) |
105 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); | 107 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); |
106 #endif | 108 #endif |
107 | 109 |
108 views::ViewsDelegate::views_delegate = new AthenaViewsDelegate(); | 110 views::ViewsDelegate::views_delegate = new AthenaViewsDelegate(); |
109 | 111 |
110 AthenaEnvState* env_state = new AthenaEnvState; | 112 AthenaEnvState* env_state = new AthenaEnvState; |
111 | 113 |
112 // Setup VisibilityClient | 114 // Setup VisibilityClient |
113 env_state->visibility_client.reset(new ::wm::VisibilityController); | 115 env_state->visibility_client.reset(new ::wm::VisibilityController); |
| 116 aura::Window* root_window = athena::AthenaEnv::Get()->GetHost()->window(); |
114 | 117 |
115 aura::client::SetVisibilityClient(root_window, | 118 aura::client::SetVisibilityClient(root_window, |
116 env_state->visibility_client.get()); | 119 env_state->visibility_client.get()); |
117 | 120 |
118 athena::SystemUI::Create(file_runner); | 121 athena::SystemUI::Create(file_runner); |
119 athena::InputManager::Create()->OnRootWindowCreated(root_window); | 122 athena::InputManager::Create()->OnRootWindowCreated(root_window); |
120 athena::ScreenManager::Create(delegate, root_window); | 123 athena::ScreenManager::Create(root_window); |
121 athena::WindowManager::Create(); | 124 athena::WindowManager::Create(); |
122 athena::AppRegistry::Create(); | 125 athena::AppRegistry::Create(); |
123 SetupBackgroundImage(); | 126 SetupBackgroundImage(); |
124 | 127 |
125 athena::ScreenManager::Get()->GetContext()->SetProperty( | 128 athena::ScreenManager::Get()->GetContext()->SetProperty( |
126 kAthenaEnvStateKey, env_state); | 129 kAthenaEnvStateKey, env_state); |
127 } | 130 } |
128 | 131 |
129 void StartAthenaSessionWithContext(content::BrowserContext* context) { | 132 void StartAthenaSessionWithContext(content::BrowserContext* context) { |
130 athena::ExtensionsDelegate::CreateExtensionsDelegateForShell(context); | 133 athena::ExtensionsDelegate::CreateExtensionsDelegateForShell(context); |
(...skipping 21 matching lines...) Expand all Loading... |
152 void ShutdownAthena() { | 155 void ShutdownAthena() { |
153 athena::ActivityFactory::Shutdown(); | 156 athena::ActivityFactory::Shutdown(); |
154 athena::ActivityManager::Shutdown(); | 157 athena::ActivityManager::Shutdown(); |
155 athena::HomeCard::Shutdown(); | 158 athena::HomeCard::Shutdown(); |
156 athena::AppRegistry::ShutDown(); | 159 athena::AppRegistry::ShutDown(); |
157 athena::WindowManager::Shutdown(); | 160 athena::WindowManager::Shutdown(); |
158 athena::ScreenManager::Shutdown(); | 161 athena::ScreenManager::Shutdown(); |
159 athena::InputManager::Shutdown(); | 162 athena::InputManager::Shutdown(); |
160 athena::SystemUI::Shutdown(); | 163 athena::SystemUI::Shutdown(); |
161 athena::ExtensionsDelegate::Shutdown(); | 164 athena::ExtensionsDelegate::Shutdown(); |
| 165 athena::AthenaEnv::Shutdown(); |
162 | 166 |
163 delete views::ViewsDelegate::views_delegate; | 167 delete views::ViewsDelegate::views_delegate; |
164 } | 168 } |
165 | 169 |
166 } // namespace athena | 170 } // namespace athena |
OLD | NEW |