| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace athena { | 39 namespace athena { |
| 40 struct AthenaEnvState; | 40 struct AthenaEnvState; |
| 41 } | 41 } |
| 42 | 42 |
| 43 DECLARE_WINDOW_PROPERTY_TYPE(athena::AthenaEnvState*); | 43 DECLARE_WINDOW_PROPERTY_TYPE(athena::AthenaEnvState*); |
| 44 | 44 |
| 45 namespace athena { | 45 namespace athena { |
| 46 | 46 |
| 47 namespace { |
| 48 |
| 49 bool session_started = false; |
| 50 |
| 51 } // namespace |
| 52 |
| 47 class VirtualKeyboardObserver; | 53 class VirtualKeyboardObserver; |
| 48 | 54 |
| 49 // Athena's env state. | 55 // Athena's env state. |
| 50 struct AthenaEnvState { | 56 struct AthenaEnvState { |
| 51 scoped_ptr< ::wm::VisibilityController> visibility_client; | 57 scoped_ptr< ::wm::VisibilityController> visibility_client; |
| 52 scoped_ptr<VirtualKeyboardObserver> virtual_keyboard_observer; | 58 scoped_ptr<VirtualKeyboardObserver> virtual_keyboard_observer; |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 DEFINE_OWNED_WINDOW_PROPERTY_KEY(athena::AthenaEnvState, | 61 DEFINE_OWNED_WINDOW_PROPERTY_KEY(athena::AthenaEnvState, |
| 56 kAthenaEnvStateKey, | 62 kAthenaEnvStateKey, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 AthenaEnvState* env_state = | 130 AthenaEnvState* env_state = |
| 125 athena::ScreenManager::Get()->GetContext()->GetProperty( | 131 athena::ScreenManager::Get()->GetContext()->GetProperty( |
| 126 kAthenaEnvStateKey); | 132 kAthenaEnvStateKey); |
| 127 | 133 |
| 128 env_state->virtual_keyboard_observer.reset(new VirtualKeyboardObserver); | 134 env_state->virtual_keyboard_observer.reset(new VirtualKeyboardObserver); |
| 129 CreateTestPages(context); | 135 CreateTestPages(context); |
| 130 } | 136 } |
| 131 | 137 |
| 132 void StartAthenaSession(athena::ActivityFactory* activity_factory, | 138 void StartAthenaSession(athena::ActivityFactory* activity_factory, |
| 133 athena::AppModelBuilder* app_model_builder) { | 139 athena::AppModelBuilder* app_model_builder) { |
| 140 DCHECK(!session_started); |
| 141 session_started = true; |
| 134 athena::HomeCard::Create(app_model_builder); | 142 athena::HomeCard::Create(app_model_builder); |
| 135 athena::ActivityManager::Create(); | 143 athena::ActivityManager::Create(); |
| 136 athena::ResourceManager::Create(); | 144 athena::ResourceManager::Create(); |
| 137 athena::ActivityFactory::RegisterActivityFactory(activity_factory); | 145 athena::ActivityFactory::RegisterActivityFactory(activity_factory); |
| 138 } | 146 } |
| 139 | 147 |
| 140 void ShutdownAthena() { | 148 void ShutdownAthena() { |
| 141 athena::ActivityFactory::Shutdown(); | 149 if (session_started) { |
| 142 athena::ResourceManager::Shutdown(); | 150 athena::ActivityFactory::Shutdown(); |
| 143 athena::ActivityManager::Shutdown(); | 151 athena::ResourceManager::Shutdown(); |
| 144 athena::HomeCard::Shutdown(); | 152 athena::ActivityManager::Shutdown(); |
| 153 athena::HomeCard::Shutdown(); |
| 154 session_started = false; |
| 155 } |
| 145 athena::AppRegistry::ShutDown(); | 156 athena::AppRegistry::ShutDown(); |
| 146 athena::WindowManager::Shutdown(); | 157 athena::WindowManager::Shutdown(); |
| 147 athena::SystemUI::Shutdown(); | 158 athena::SystemUI::Shutdown(); |
| 148 athena::ScreenManager::Shutdown(); | 159 athena::ScreenManager::Shutdown(); |
| 149 athena::InputManager::Shutdown(); | 160 athena::InputManager::Shutdown(); |
| 150 athena::ExtensionsDelegate::Shutdown(); | 161 athena::ExtensionsDelegate::Shutdown(); |
| 151 athena::AthenaEnv::Shutdown(); | 162 athena::AthenaEnv::Shutdown(); |
| 152 | 163 |
| 153 delete views::ViewsDelegate::views_delegate; | 164 delete views::ViewsDelegate::views_delegate; |
| 154 } | 165 } |
| 155 | 166 |
| 156 } // namespace athena | 167 } // namespace athena |
| OLD | NEW |