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/public/athena_launcher.h" | 5 #include "athena/main/public/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_creator.h" | 10 #include "athena/content/public/content_activity_factory_creator.h" |
11 #include "athena/env/public/athena_env.h" | 11 #include "athena/env/public/athena_env.h" |
| 12 #include "athena/extensions/public/apps_search_controller_factory.h" |
12 #include "athena/extensions/public/extension_app_model_builder.h" | 13 #include "athena/extensions/public/extension_app_model_builder.h" |
13 #include "athena/extensions/public/extensions_delegate.h" | 14 #include "athena/extensions/public/extensions_delegate.h" |
14 #include "athena/home/public/home_card.h" | 15 #include "athena/home/public/home_card.h" |
| 16 #include "athena/home/public/search_controller_factory.h" |
15 #include "athena/input/public/input_manager.h" | 17 #include "athena/input/public/input_manager.h" |
16 #include "athena/main/athena_views_delegate.h" | 18 #include "athena/main/athena_views_delegate.h" |
17 #include "athena/main/placeholder.h" | 19 #include "athena/main/placeholder.h" |
18 #include "athena/main/placeholder.h" | 20 #include "athena/main/placeholder.h" |
19 #include "athena/main/url_search_provider.h" | |
20 #include "athena/resource_manager/public/resource_manager.h" | 21 #include "athena/resource_manager/public/resource_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 "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
28 #include "ui/app_list/app_list_switches.h" | 29 #include "ui/app_list/app_list_switches.h" |
29 #include "ui/aura/window_property.h" | 30 #include "ui/aura/window_property.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 athena::ScreenManager::Get()->GetContext()->SetProperty( | 122 athena::ScreenManager::Get()->GetContext()->SetProperty( |
122 kAthenaEnvStateKey, env_state); | 123 kAthenaEnvStateKey, env_state); |
123 } | 124 } |
124 | 125 |
125 void CreateVirtualKeyboardWithContext(content::BrowserContext* context) { | 126 void CreateVirtualKeyboardWithContext(content::BrowserContext* context) { |
126 athena::VirtualKeyboardManager::Create(context); | 127 athena::VirtualKeyboardManager::Create(context); |
127 } | 128 } |
128 | 129 |
129 void StartAthenaSessionWithContext(content::BrowserContext* context) { | 130 void StartAthenaSessionWithContext(content::BrowserContext* context) { |
130 athena::ExtensionsDelegate::CreateExtensionsDelegate(context); | 131 athena::ExtensionsDelegate::CreateExtensionsDelegate(context); |
131 StartAthenaSession(athena::CreateContentActivityFactory(), | 132 StartAthenaSession( |
132 new athena::ExtensionAppModelBuilder(context)); | 133 athena::CreateContentActivityFactory(), |
133 athena::HomeCard::Get()->RegisterSearchProvider( | 134 make_scoped_ptr(new athena::ExtensionAppModelBuilder(context)), |
134 new athena::UrlSearchProvider(context)); | 135 athena::CreateSearchControllerFactory(context)); |
135 AthenaEnvState* env_state = | 136 AthenaEnvState* env_state = |
136 athena::ScreenManager::Get()->GetContext()->GetProperty( | 137 athena::ScreenManager::Get()->GetContext()->GetProperty( |
137 kAthenaEnvStateKey); | 138 kAthenaEnvStateKey); |
138 | 139 |
139 env_state->virtual_keyboard_observer.reset(new VirtualKeyboardObserver); | 140 env_state->virtual_keyboard_observer.reset(new VirtualKeyboardObserver); |
140 CreateTestPages(context); | 141 CreateTestPages(context); |
141 } | 142 } |
142 | 143 |
143 void StartAthenaSession(athena::ActivityFactory* activity_factory, | 144 void StartAthenaSession( |
144 athena::AppModelBuilder* app_model_builder) { | 145 athena::ActivityFactory* activity_factory, |
| 146 scoped_ptr<athena::AppModelBuilder> app_model_builder, |
| 147 scoped_ptr<athena::SearchControllerFactory> search_factory) { |
145 DCHECK(!session_started); | 148 DCHECK(!session_started); |
146 session_started = true; | 149 session_started = true; |
147 athena::HomeCard::Create(app_model_builder); | 150 athena::HomeCard::Create(app_model_builder.Pass(), search_factory.Pass()); |
148 athena::ActivityManager::Create(); | 151 athena::ActivityManager::Create(); |
149 athena::ResourceManager::Create(); | 152 athena::ResourceManager::Create(); |
150 athena::ActivityFactory::RegisterActivityFactory(activity_factory); | 153 athena::ActivityFactory::RegisterActivityFactory(activity_factory); |
151 } | 154 } |
152 | 155 |
153 void ShutdownAthena() { | 156 void ShutdownAthena() { |
154 if (session_started) { | 157 if (session_started) { |
155 athena::ActivityFactory::Shutdown(); | 158 athena::ActivityFactory::Shutdown(); |
156 athena::ResourceManager::Shutdown(); | 159 athena::ResourceManager::Shutdown(); |
157 athena::ActivityManager::Shutdown(); | 160 athena::ActivityManager::Shutdown(); |
158 athena::HomeCard::Shutdown(); | 161 athena::HomeCard::Shutdown(); |
159 athena::ExtensionsDelegate::Shutdown(); | 162 athena::ExtensionsDelegate::Shutdown(); |
160 session_started = false; | 163 session_started = false; |
161 } | 164 } |
162 athena::AppRegistry::ShutDown(); | 165 athena::AppRegistry::ShutDown(); |
163 athena::WindowManager::Shutdown(); | 166 athena::WindowManager::Shutdown(); |
164 athena::SystemUI::Shutdown(); | 167 athena::SystemUI::Shutdown(); |
165 athena::ScreenManager::Shutdown(); | 168 athena::ScreenManager::Shutdown(); |
166 athena::InputManager::Shutdown(); | 169 athena::InputManager::Shutdown(); |
167 athena::AthenaEnv::Shutdown(); | 170 athena::AthenaEnv::Shutdown(); |
168 | 171 |
169 ShutdownAthenaViewsDelegate(); | 172 ShutdownAthenaViewsDelegate(); |
170 } | 173 } |
171 | 174 |
172 } // namespace athena | 175 } // namespace athena |
OLD | NEW |