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/screen/public/screen_manager.h" | 7 #include "athena/screen/public/screen_manager.h" |
8 #include "athena/system/background_controller.h" | 8 #include "athena/system/background_controller.h" |
9 #include "athena/system/orientation_controller.h" | 9 #include "athena/system/orientation_controller.h" |
10 #include "athena/system/shutdown_dialog.h" | 10 #include "athena/system/shutdown_dialog.h" |
11 #include "athena/system/status_icon_container_view.h" | 11 #include "athena/system/status_icon_container_view.h" |
12 #include "athena/system/time_view.h" | 12 #include "athena/system/time_view.h" |
13 #include "athena/util/container_priorities.h" | 13 #include "athena/util/container_priorities.h" |
14 #include "athena/util/fill_layout_manager.h" | 14 #include "athena/util/fill_layout_manager.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
20 | 20 |
21 namespace athena { | 21 namespace athena { |
22 namespace { | 22 namespace { |
23 | 23 |
24 SystemUI* instance = NULL; | 24 SystemUI* instance = nullptr; |
25 | 25 |
26 // View which positions the TimeView on the left and the StatusIconView on the | 26 // View which positions the TimeView on the left and the StatusIconView on the |
27 // right. | 27 // right. |
28 class SystemInfoView : public views::View { | 28 class SystemInfoView : public views::View { |
29 public: | 29 public: |
30 SystemInfoView(SystemUI::ColorScheme color_scheme) | 30 SystemInfoView(SystemUI::ColorScheme color_scheme) |
31 : time_view_(new TimeView(color_scheme)), | 31 : time_view_(new TimeView(color_scheme)), |
32 status_icon_view_(new StatusIconContainerView(color_scheme)) { | 32 status_icon_view_(new StatusIconContainerView(color_scheme)) { |
33 AddChildView(time_view_); | 33 AddChildView(time_view_); |
34 AddChildView(status_icon_view_); | 34 AddChildView(status_icon_view_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 views::View* time_view_; | 67 views::View* time_view_; |
68 views::View* status_icon_view_; | 68 views::View* status_icon_view_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(SystemInfoView); | 70 DISALLOW_COPY_AND_ASSIGN(SystemInfoView); |
71 }; | 71 }; |
72 | 72 |
73 class SystemUIImpl : public SystemUI { | 73 class SystemUIImpl : public SystemUI { |
74 public: | 74 public: |
75 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner) | 75 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner) |
76 : orientation_controller_(new OrientationController()), | 76 : orientation_controller_(new OrientationController()), |
77 background_container_(NULL) { | 77 background_container_(nullptr) { |
78 orientation_controller_->InitWith(blocking_task_runner); | 78 orientation_controller_->InitWith(blocking_task_runner); |
79 } | 79 } |
80 | 80 |
81 virtual ~SystemUIImpl() { | 81 virtual ~SystemUIImpl() { |
82 // Stops file watching now if exists. Waiting until message loop shutdon | 82 // Stops file watching now if exists. Waiting until message loop shutdon |
83 // leads to FilePathWatcher crash. | 83 // leads to FilePathWatcher crash. |
84 orientation_controller_->Shutdown(); | 84 orientation_controller_->Shutdown(); |
85 } | 85 } |
86 | 86 |
87 void Init() { | 87 void Init() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // static | 137 // static |
138 SystemUI* SystemUI::Get() { | 138 SystemUI* SystemUI::Get() { |
139 DCHECK(instance); | 139 DCHECK(instance); |
140 return instance; | 140 return instance; |
141 } | 141 } |
142 | 142 |
143 // static | 143 // static |
144 void SystemUI::Shutdown() { | 144 void SystemUI::Shutdown() { |
145 CHECK(instance); | 145 CHECK(instance); |
146 delete instance; | 146 delete instance; |
147 instance = NULL; | 147 instance = nullptr; |
148 } | 148 } |
149 | 149 |
150 } // namespace athena | 150 } // namespace athena |
OLD | NEW |