Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1081)

Side by Side Diff: athena/system/system_ui_impl.cc

Issue 483363003: [Athena] Add status icons and system time to the desktop background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" 7 #include "athena/system/device_socket_listener.h"
8 #include "athena/system/orientation_controller.h" 8 #include "athena/system/orientation_controller.h"
9 #include "athena/system/power_button_controller.h" 9 #include "athena/system/power_button_controller.h"
10 #include "athena/system/status_icon_container_view.h"
11 #include "athena/system/time_view.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
13 15
14 namespace athena { 16 namespace athena {
15 namespace { 17 namespace {
16 18
17 SystemUI* instance = NULL; 19 SystemUI* instance = NULL;
18 20
19 class SystemUIImpl : public SystemUI { 21 class SystemUIImpl : public SystemUI {
20 public: 22 public:
21 SystemUIImpl(scoped_refptr<base::TaskRunner> io_task_runner) 23 SystemUIImpl(scoped_refptr<base::TaskRunner> io_task_runner)
22 : orientation_controller_(new OrientationController()), 24 : orientation_controller_(new OrientationController()),
23 power_button_controller_(new PowerButtonController) { 25 power_button_controller_(new PowerButtonController) {
24 orientation_controller_->InitWith(io_task_runner); 26 orientation_controller_->InitWith(io_task_runner);
25 } 27 }
26 28
27 virtual ~SystemUIImpl() { 29 virtual ~SystemUIImpl() {
28 } 30 }
29 31
32 virtual views::View* CreateTimeView() OVERRIDE {
33 return new TimeView;
34 }
35
36 virtual views::View* CreateStatusIconView(
37 aura::Window* popup_container) OVERRIDE {
38 return new StatusIconContainerView(popup_container);
39 }
40
30 private: 41 private:
31 scoped_refptr<OrientationController> orientation_controller_; 42 scoped_refptr<OrientationController> orientation_controller_;
32 scoped_ptr<PowerButtonController> power_button_controller_; 43 scoped_ptr<PowerButtonController> power_button_controller_;
33 44
34 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl); 45 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl);
35 }; 46 };
36 47
37 } // namespace 48 } // namespace
38 49
39 // static 50 // static
51 SystemUI* SystemUI::Get() {
52 return instance;
sadrul 2014/08/21 18:44:30 DCHECK(instance) (that would be consistent with th
53 }
54
40 SystemUI* SystemUI::Create( 55 SystemUI* SystemUI::Create(
41 scoped_refptr<base::TaskRunner> io_task_runner) { 56 scoped_refptr<base::TaskRunner> io_task_runner) {
42 DeviceSocketListener::CreateSocketManager(io_task_runner); 57 DeviceSocketListener::CreateSocketManager(io_task_runner);
43 instance = new SystemUIImpl(io_task_runner); 58 instance = new SystemUIImpl(io_task_runner);
44 return instance; 59 return instance;
45 } 60 }
46 61
47 // static 62 // static
48 void SystemUI::Shutdown() { 63 void SystemUI::Shutdown() {
49 CHECK(instance); 64 CHECK(instance);
50 delete instance; 65 delete instance;
51 instance = NULL; 66 instance = NULL;
52 DeviceSocketListener::ShutdownSocketManager(); 67 DeviceSocketListener::ShutdownSocketManager();
53 } 68 }
54 69
55 } // namespace athena 70 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698