| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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_); |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual ~SystemInfoView() { | 37 ~SystemInfoView() override {} |
| 38 } | |
| 39 | 38 |
| 40 // views::View: | 39 // views::View: |
| 41 virtual gfx::Size GetPreferredSize() const override { | 40 virtual gfx::Size GetPreferredSize() const override { |
| 42 // The view should be as wide as its parent view. | 41 // The view should be as wide as its parent view. |
| 43 return gfx::Size(0, | 42 return gfx::Size(0, |
| 44 std::max(time_view_->GetPreferredSize().height(), | 43 std::max(time_view_->GetPreferredSize().height(), |
| 45 status_icon_view_->GetPreferredSize().height())); | 44 status_icon_view_->GetPreferredSize().height())); |
| 46 } | 45 } |
| 47 | 46 |
| 48 virtual void Layout() override { | 47 virtual void Layout() override { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 class SystemUIImpl : public SystemUI { | 72 class SystemUIImpl : public SystemUI { |
| 74 public: | 73 public: |
| 75 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner) | 74 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner) |
| 76 : orientation_controller_(new OrientationController()), | 75 : orientation_controller_(new OrientationController()), |
| 77 background_container_(nullptr) { | 76 background_container_(nullptr) { |
| 78 orientation_controller_->InitWith(blocking_task_runner); | 77 orientation_controller_->InitWith(blocking_task_runner); |
| 79 } | 78 } |
| 80 | 79 |
| 81 virtual ~SystemUIImpl() { | 80 ~SystemUIImpl() override { |
| 82 // Stops file watching now if exists. Waiting until message loop shutdon | 81 // Stops file watching now if exists. Waiting until message loop shutdon |
| 83 // leads to FilePathWatcher crash. | 82 // leads to FilePathWatcher crash. |
| 84 orientation_controller_->Shutdown(); | 83 orientation_controller_->Shutdown(); |
| 85 } | 84 } |
| 86 | 85 |
| 87 void Init() { | 86 void Init() { |
| 88 ScreenManager* screen_manager = ScreenManager::Get(); | 87 ScreenManager* screen_manager = ScreenManager::Get(); |
| 89 background_container_ = screen_manager->CreateContainer( | 88 background_container_ = screen_manager->CreateContainer( |
| 90 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND)); | 89 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND)); |
| 91 background_container_->SetLayoutManager( | 90 background_container_->SetLayoutManager( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 140 } |
| 142 | 141 |
| 143 // static | 142 // static |
| 144 void SystemUI::Shutdown() { | 143 void SystemUI::Shutdown() { |
| 145 CHECK(instance); | 144 CHECK(instance); |
| 146 delete instance; | 145 delete instance; |
| 147 instance = nullptr; | 146 instance = nullptr; |
| 148 } | 147 } |
| 149 | 148 |
| 150 } // namespace athena | 149 } // namespace athena |
| OLD | NEW |