| 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/home/public/home_card.h" | 9 #include "athena/home/public/home_card.h" |
| 10 #include "athena/input/public/input_manager.h" | 10 #include "athena/input/public/input_manager.h" |
| 11 #include "athena/main/placeholder.h" | 11 #include "athena/main/placeholder.h" |
| 12 #include "athena/screen/public/screen_manager.h" | 12 #include "athena/screen/public/screen_manager.h" |
| 13 #include "athena/system/public/system_ui.h" | 13 #include "athena/system/public/system_ui.h" |
| 14 #include "athena/wm/public/window_manager.h" | 14 #include "athena/wm/public/window_manager.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "ui/aura/window_property.h" | 16 #include "ui/aura/window_property.h" |
| 17 #include "ui/views/views_delegate.h" |
| 17 #include "ui/wm/core/visibility_controller.h" | 18 #include "ui/wm/core/visibility_controller.h" |
| 18 | 19 |
| 19 #if defined(USE_X11) | 20 #if defined(USE_X11) |
| 20 #include "ui/events/x/touch_factory_x11.h" | 21 #include "ui/events/x/touch_factory_x11.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace athena { | 24 namespace athena { |
| 24 struct RootWindowState; | 25 struct RootWindowState; |
| 25 } | 26 } |
| 26 | 27 |
| 27 DECLARE_WINDOW_PROPERTY_TYPE(athena::RootWindowState*); | 28 DECLARE_WINDOW_PROPERTY_TYPE(athena::RootWindowState*); |
| 28 | 29 |
| 29 namespace athena { | 30 namespace athena { |
| 30 | 31 |
| 31 // Athena's per root window state. | 32 // Athena's per root window state. |
| 32 struct RootWindowState { | 33 struct RootWindowState { |
| 33 scoped_ptr< ::wm::VisibilityController> visibility_client; | 34 scoped_ptr< ::wm::VisibilityController> visibility_client; |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 DEFINE_OWNED_WINDOW_PROPERTY_KEY(athena::RootWindowState, | 37 DEFINE_OWNED_WINDOW_PROPERTY_KEY(athena::RootWindowState, |
| 37 kRootWindowStateKey, | 38 kRootWindowStateKey, |
| 38 NULL); | 39 NULL); |
| 39 | 40 |
| 41 class AthenaViewsDelegate : public views::ViewsDelegate { |
| 42 public: |
| 43 AthenaViewsDelegate() {} |
| 44 virtual ~AthenaViewsDelegate() {} |
| 45 |
| 46 private: |
| 47 // views::ViewsDelegate: |
| 48 virtual void OnBeforeWidgetInit( |
| 49 views::Widget::InitParams* params, |
| 50 views::internal::NativeWidgetDelegate* delegate) OVERRIDE { |
| 51 } |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegate); |
| 54 }; |
| 55 |
| 40 void StartAthena(aura::Window* root_window, | 56 void StartAthena(aura::Window* root_window, |
| 41 athena::ActivityFactory* activity_factory, | 57 athena::ActivityFactory* activity_factory, |
| 42 athena::AppModelBuilder* app_model_builder) { | 58 athena::AppModelBuilder* app_model_builder) { |
| 43 #if defined(USE_X11) | 59 #if defined(USE_X11) |
| 44 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); | 60 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); |
| 45 #endif | 61 #endif |
| 62 |
| 63 views::ViewsDelegate::views_delegate = new AthenaViewsDelegate(); |
| 64 |
| 46 RootWindowState* root_window_state = new RootWindowState; | 65 RootWindowState* root_window_state = new RootWindowState; |
| 47 root_window->SetProperty(kRootWindowStateKey, root_window_state); | 66 root_window->SetProperty(kRootWindowStateKey, root_window_state); |
| 48 | 67 |
| 49 root_window_state->visibility_client.reset(new ::wm::VisibilityController); | 68 root_window_state->visibility_client.reset(new ::wm::VisibilityController); |
| 50 aura::client::SetVisibilityClient(root_window, | 69 aura::client::SetVisibilityClient(root_window, |
| 51 root_window_state->visibility_client.get()); | 70 root_window_state->visibility_client.get()); |
| 52 | 71 |
| 53 athena::SystemUI::Create(); | 72 athena::SystemUI::Create(); |
| 54 athena::InputManager::Create()->OnRootWindowCreated(root_window); | 73 athena::InputManager::Create()->OnRootWindowCreated(root_window); |
| 55 athena::ScreenManager::Create(root_window); | 74 athena::ScreenManager::Create(root_window); |
| 56 athena::WindowManager::Create(); | 75 athena::WindowManager::Create(); |
| 57 athena::HomeCard::Create(app_model_builder); | 76 athena::HomeCard::Create(app_model_builder); |
| 58 athena::ActivityManager::Create(); | 77 athena::ActivityManager::Create(); |
| 59 athena::ActivityFactory::RegisterActivityFactory(activity_factory); | 78 athena::ActivityFactory::RegisterActivityFactory(activity_factory); |
| 60 SetupBackgroundImage(); | 79 SetupBackgroundImage(); |
| 61 } | 80 } |
| 62 | 81 |
| 63 void ShutdownAthena() { | 82 void ShutdownAthena() { |
| 64 athena::ActivityFactory::Shutdown(); | 83 athena::ActivityFactory::Shutdown(); |
| 65 athena::ActivityManager::Shutdown(); | 84 athena::ActivityManager::Shutdown(); |
| 66 athena::HomeCard::Shutdown(); | 85 athena::HomeCard::Shutdown(); |
| 67 athena::WindowManager::Shutdown(); | 86 athena::WindowManager::Shutdown(); |
| 68 athena::ScreenManager::Shutdown(); | 87 athena::ScreenManager::Shutdown(); |
| 69 athena::InputManager::Shutdown(); | 88 athena::InputManager::Shutdown(); |
| 70 athena::SystemUI::Shutdown(); | 89 athena::SystemUI::Shutdown(); |
| 90 |
| 91 delete views::ViewsDelegate::views_delegate; |
| 71 } | 92 } |
| 72 | 93 |
| 73 } // namespace athena | 94 } // namespace athena |
| OLD | NEW |