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
3 // found in the LICENSE file.
5 #include "athena/system/public/system_ui.h"
7 #include "athena/system/device_socket_listener.h"
8 #include "athena/system/orientation_controller.h"
9 #include "athena/system/power_button_controller.h"
10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
17 SystemUI
* instance
= NULL
;
19 class SystemUIImpl
: public SystemUI
{
21 SystemUIImpl(scoped_refptr
<base::TaskRunner
> file_task_runner
)
22 : orientation_controller_(new OrientationController()),
23 power_button_controller_(new PowerButtonController
) {
24 orientation_controller_
->InitWith(file_task_runner
);
27 virtual ~SystemUIImpl() {
28 // Stops file watching now if exists. Waiting until message loop shutdon
29 // leads to FilePathWatcher crash.
30 orientation_controller_
->Shutdown();
34 scoped_refptr
<OrientationController
> orientation_controller_
;
35 scoped_ptr
<PowerButtonController
> power_button_controller_
;
37 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl
);
43 SystemUI
* SystemUI::Create(scoped_refptr
<base::TaskRunner
> file_task_runner
) {
44 DeviceSocketListener::CreateSocketManager(file_task_runner
);
45 instance
= new SystemUIImpl(file_task_runner
);
50 void SystemUI::Shutdown() {
54 DeviceSocketListener::ShutdownSocketManager();