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

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, 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 | Annotate | Revision Log
« no previous file with comments | « athena/system/status_icon_container_view.cc ('k') | athena/system/time_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> file_task_runner) 28 SystemUIImpl(scoped_refptr<base::TaskRunner> file_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(file_task_runner); 33 orientation_controller_->InitWith(file_task_runner);
25 } 34 }
26 35
27 virtual ~SystemUIImpl() { 36 virtual ~SystemUIImpl() {
28 // Stops file watching now if exists. Waiting until message loop shutdon 37 // Stops file watching now if exists. Waiting until message loop shutdon
29 // leads to FilePathWatcher crash. 38 // leads to FilePathWatcher crash.
30 orientation_controller_->Shutdown(); 39 orientation_controller_->Shutdown();
31 } 40 }
32 41
42 void Init() {
43 background_container_ = ScreenManager::Get()->CreateContainer(
44 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND));
45 background_container_->SetLayoutManager(
46 new FillLayoutManager(background_container_));
47 ScreenManager::ContainerParams system_modal_params(
48 "AthenaSystemModalContainer", CP_SYSTEM_MODAL);
49 system_modal_params.can_activate_children = true;
50 system_modal_container_ =
51 ScreenManager::Get()->CreateContainer(system_modal_params);
52
53 background_controller_.reset(
54 new BackgroundController(background_container_));
55 }
56
57 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE {
58 background_controller_->SetImage(image);
59 }
60
61 virtual views::View* CreateTimeView() OVERRIDE {
62 return new TimeView;
63 }
64
65 virtual views::View* CreateStatusIconView() OVERRIDE {
66 return new StatusIconContainerView(system_modal_container_);
67 }
68
33 private: 69 private:
34 scoped_refptr<OrientationController> orientation_controller_; 70 scoped_refptr<OrientationController> orientation_controller_;
35 scoped_ptr<PowerButtonController> power_button_controller_; 71 scoped_ptr<PowerButtonController> power_button_controller_;
72 scoped_ptr<BackgroundController> background_controller_;
73
74 // The parent container for the background.
75 aura::Window* background_container_;
76
77 // The parent container used by the "select network" dialog.
78 aura::Window* system_modal_container_;
36 79
37 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl); 80 DISALLOW_COPY_AND_ASSIGN(SystemUIImpl);
38 }; 81 };
39 82
40 } // namespace 83 } // namespace
41 84
42 // static 85 // static
43 SystemUI* SystemUI::Create(scoped_refptr<base::TaskRunner> file_task_runner) { 86 SystemUI* SystemUI::Create(scoped_refptr<base::TaskRunner> file_task_runner) {
44 DeviceSocketListener::CreateSocketManager(file_task_runner); 87 DeviceSocketListener::CreateSocketManager(file_task_runner);
45 instance = new SystemUIImpl(file_task_runner); 88 SystemUIImpl* system_ui = new SystemUIImpl(file_task_runner);
89 instance = system_ui;
90 system_ui->Init();
46 return instance; 91 return instance;
47 } 92 }
48 93
94 // static
95 SystemUI* SystemUI::Get() {
96 DCHECK(instance);
97 return instance;
98 }
99
49 // static 100 // static
50 void SystemUI::Shutdown() { 101 void SystemUI::Shutdown() {
51 CHECK(instance); 102 CHECK(instance);
52 delete instance; 103 delete instance;
53 instance = NULL; 104 instance = NULL;
54 DeviceSocketListener::ShutdownSocketManager(); 105 DeviceSocketListener::ShutdownSocketManager();
55 } 106 }
56 107
57 } // namespace athena 108 } // namespace athena
OLDNEW
« no previous file with comments | « athena/system/status_icon_container_view.cc ('k') | athena/system/time_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698