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