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

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

Issue 585623003: [Athena] Make a quick power button tap suspend the device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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/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/power_button_controller.h" 10 #include "athena/system/power_button_controller.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 views::View* time_view_; 69 views::View* time_view_;
70 views::View* status_icon_view_; 70 views::View* status_icon_view_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(SystemInfoView); 72 DISALLOW_COPY_AND_ASSIGN(SystemInfoView);
73 }; 73 };
74 74
75 class SystemUIImpl : public SystemUI { 75 class SystemUIImpl : public SystemUI {
76 public: 76 public:
77 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner) 77 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner)
78 : orientation_controller_(new OrientationController()), 78 : orientation_controller_(new OrientationController()),
79 power_button_controller_(new PowerButtonController),
80 background_container_(NULL), 79 background_container_(NULL),
81 system_modal_container_(NULL) { 80 system_modal_container_(NULL) {
82 orientation_controller_->InitWith(blocking_task_runner); 81 orientation_controller_->InitWith(blocking_task_runner);
83 } 82 }
84 83
85 virtual ~SystemUIImpl() { 84 virtual ~SystemUIImpl() {
86 // Stops file watching now if exists. Waiting until message loop shutdon 85 // Stops file watching now if exists. Waiting until message loop shutdon
87 // leads to FilePathWatcher crash. 86 // leads to FilePathWatcher crash.
88 orientation_controller_->Shutdown(); 87 orientation_controller_->Shutdown();
89 } 88 }
90 89
91 void Init() { 90 void Init() {
92 background_container_ = ScreenManager::Get()->CreateContainer( 91 background_container_ = ScreenManager::Get()->CreateContainer(
93 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND)); 92 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND));
94 background_container_->SetLayoutManager( 93 background_container_->SetLayoutManager(
95 new FillLayoutManager(background_container_)); 94 new FillLayoutManager(background_container_));
96 ScreenManager::ContainerParams system_modal_params( 95 ScreenManager::ContainerParams system_modal_params(
97 "AthenaSystemModalContainer", CP_SYSTEM_MODAL); 96 "AthenaSystemModalContainer", CP_SYSTEM_MODAL);
98 system_modal_params.can_activate_children = true; 97 system_modal_params.can_activate_children = true;
99 system_modal_container_ = 98 system_modal_container_ =
100 ScreenManager::Get()->CreateContainer(system_modal_params); 99 ScreenManager::Get()->CreateContainer(system_modal_params);
101 100
101 power_button_controller_.reset(
102 new PowerButtonController(system_modal_container_));
flackr 2014/09/19 14:45:29 This container doesn't seem to show above the logi
pkotwicz 2014/09/20 00:01:59 Thanks for catching this! I have added a new cont
102 background_controller_.reset( 103 background_controller_.reset(
103 new BackgroundController(background_container_)); 104 new BackgroundController(background_container_));
104 } 105 }
105 106
106 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE { 107 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE {
107 background_controller_->SetImage(image); 108 background_controller_->SetImage(image);
108 } 109 }
109 110
110 virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) OVERRIDE { 111 virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) OVERRIDE {
111 return new SystemInfoView(color_scheme, system_modal_container_); 112 return new SystemInfoView(color_scheme, system_modal_container_);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 144 }
144 145
145 // static 146 // static
146 void SystemUI::Shutdown() { 147 void SystemUI::Shutdown() {
147 CHECK(instance); 148 CHECK(instance);
148 delete instance; 149 delete instance;
149 instance = NULL; 150 instance = NULL;
150 } 151 }
151 152
152 } // namespace athena 153 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698