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