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

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/common/container_priorities.h"
8 #include "athena/common/fill_layout_manager.h"
9 #include "athena/screen/public/screen_manager.h"
10 #include "athena/system/background_controller.h"
7 #include "athena/system/device_socket_listener.h" 11 #include "athena/system/device_socket_listener.h"
8 #include "athena/system/orientation_controller.h" 12 #include "athena/system/orientation_controller.h"
9 #include "athena/system/power_button_controller.h" 13 #include "athena/system/power_button_controller.h"
14 #include "athena/system/status_icon_container_view.h"
15 #include "athena/system/time_view.h"
10 #include "base/logging.h" 16 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "ui/aura/window.h"
13 20
14 namespace athena { 21 namespace athena {
15 namespace { 22 namespace {
16 23
17 SystemUI* instance = NULL; 24 SystemUI* instance = NULL;
18 25
19 class SystemUIImpl : public SystemUI { 26 class SystemUIImpl : public SystemUI {
20 public: 27 public:
21 SystemUIImpl(scoped_refptr<base::TaskRunner> io_task_runner) 28 SystemUIImpl(scoped_refptr<base::TaskRunner> io_task_runner)
22 : orientation_controller_(new OrientationController()), 29 : orientation_controller_(new OrientationController()),
23 power_button_controller_(new PowerButtonController) { 30 power_button_controller_(new PowerButtonController) ,
31 background_container_(NULL),
32 system_modal_container_(NULL) {
24 orientation_controller_->InitWith(io_task_runner); 33 orientation_controller_->InitWith(io_task_runner);
25 } 34 }
26 35
27 virtual ~SystemUIImpl() { 36 virtual ~SystemUIImpl() {
28 } 37 }
29 38
39 void Init() {
40 background_container_ = ScreenManager::Get()->CreateContainer(
41 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND));
42 background_container_->SetLayoutManager(
43 new FillLayoutManager(background_container_));
44 ScreenManager::ContainerParams system_modal_params(
45 "AthenaSystemModalContainer", CP_SYSTEM_MODAL);
46 system_modal_params.can_activate_children = true;
47 system_modal_container_ =
48 ScreenManager::Get()->CreateContainer(system_modal_params);
49
50 background_controller_.reset(
51 new BackgroundController(background_container_));
52 }
53
54 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE {
55 background_controller_->SetImage(image);
56 }
57
58 virtual views::View* CreateTimeView() OVERRIDE {
59 return new TimeView;
60 }
61
62 virtual views::View* CreateStatusIconView() OVERRIDE {
63 return new StatusIconContainerView(system_modal_container_);
64 }
65
30 private: 66 private:
31 scoped_refptr<OrientationController> orientation_controller_; 67 scoped_refptr<OrientationController> orientation_controller_;
32 scoped_ptr<PowerButtonController> power_button_controller_; 68 scoped_ptr<PowerButtonController> power_button_controller_;
69 scoped_ptr<BackgroundController> background_controller_;
70
71 // The parent container for the background.
72 aura::Window* background_container_;
73
74 // The parent container used by the "select network" dialog.
75 aura::Window* system_modal_container_;
33 76
34 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl); 77 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl);
35 }; 78 };
36 79
37 } // namespace 80 } // namespace
38 81
39 // static 82 // static
40 SystemUI* SystemUI::Create( 83 SystemUI* SystemUI::Create(
41 scoped_refptr<base::TaskRunner> io_task_runner) { 84 scoped_refptr<base::TaskRunner> io_task_runner) {
42 DeviceSocketListener::CreateSocketManager(io_task_runner); 85 DeviceSocketListener::CreateSocketManager(io_task_runner);
43 instance = new SystemUIImpl(io_task_runner); 86 SystemUIImpl* system_ui = new SystemUIImpl(io_task_runner);
87 instance = system_ui;
88 system_ui->Init();
44 return instance; 89 return instance;
45 } 90 }
46 91
92 // static
93 SystemUI* SystemUI::Get() {
94 DCHECK(instance);
95 return instance;
96 }
97
47 // static 98 // static
48 void SystemUI::Shutdown() { 99 void SystemUI::Shutdown() {
49 CHECK(instance); 100 CHECK(instance);
50 delete instance; 101 delete instance;
51 instance = NULL; 102 instance = NULL;
52 DeviceSocketListener::ShutdownSocketManager(); 103 DeviceSocketListener::ShutdownSocketManager();
53 } 104 }
54 105
55 } // namespace athena 106 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698