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/system/public/system_ui.h" | 5 #include "athena/system/public/system_ui.h" |
6 | 6 |
| 7 #include "athena/system/device_socket_listener.h" |
| 8 #include "athena/system/orientation_controller.h" |
7 #include "athena/system/power_button_controller.h" | 9 #include "athena/system/power_button_controller.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 | 13 |
11 namespace athena { | 14 namespace athena { |
12 namespace { | 15 namespace { |
13 | 16 |
14 SystemUI* instance = NULL; | 17 SystemUI* instance = NULL; |
15 | 18 |
16 class SystemUIImpl : public SystemUI { | 19 class SystemUIImpl : public SystemUI { |
17 public: | 20 public: |
18 SystemUIImpl() : power_button_controller_(new PowerButtonController) { | 21 SystemUIImpl(scoped_refptr<base::TaskRunner> io_task_runner) |
| 22 : orientation_controller_(new OrientationController(io_task_runner)), |
| 23 power_button_controller_(new PowerButtonController) { |
19 } | 24 } |
20 | 25 |
21 virtual ~SystemUIImpl() { | 26 virtual ~SystemUIImpl() { |
22 } | 27 } |
23 | 28 |
24 private: | 29 private: |
| 30 scoped_refptr<OrientationController> orientation_controller_; |
25 scoped_ptr<PowerButtonController> power_button_controller_; | 31 scoped_ptr<PowerButtonController> power_button_controller_; |
26 | 32 |
27 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl); | 33 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl); |
28 }; | 34 }; |
29 | 35 |
30 } // namespace | 36 } // namespace |
31 | 37 |
32 // static | 38 // static |
33 SystemUI* SystemUI::Create() { | 39 SystemUI* SystemUI::Create( |
34 instance = new SystemUIImpl; | 40 scoped_refptr<base::TaskRunner> io_task_runner) { |
| 41 DeviceSocketListener::CreateSocketManager(io_task_runner); |
| 42 instance = new SystemUIImpl(io_task_runner); |
35 return instance; | 43 return instance; |
36 } | 44 } |
37 | 45 |
38 // static | 46 // static |
39 void SystemUI::Shutdown() { | 47 void SystemUI::Shutdown() { |
40 CHECK(instance); | 48 CHECK(instance); |
41 delete instance; | 49 delete instance; |
42 instance = NULL; | 50 instance = NULL; |
| 51 DeviceSocketListener::ShutdownSocketManager(); |
43 } | 52 } |
44 | 53 |
45 } // namespace athena | 54 } // namespace athena |
OLD | NEW |