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

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

Issue 665803003: Revert of Support modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « athena/system/status_icon_container_view.cc ('k') | athena/test/DEPS » ('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/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 = NULL;
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 aura::Window* system_modal_container)
31 : time_view_(new TimeView(color_scheme)), 32 : time_view_(new TimeView(color_scheme)),
32 status_icon_view_(new StatusIconContainerView(color_scheme)) { 33 status_icon_view_(
34 new StatusIconContainerView(color_scheme, system_modal_container)) {
33 AddChildView(time_view_); 35 AddChildView(time_view_);
34 AddChildView(status_icon_view_); 36 AddChildView(status_icon_view_);
35 } 37 }
36 38
37 virtual ~SystemInfoView() { 39 virtual ~SystemInfoView() {
38 } 40 }
39 41
40 // views::View: 42 // views::View:
41 virtual gfx::Size GetPreferredSize() const override { 43 virtual gfx::Size GetPreferredSize() const override {
42 // The view should be as wide as its parent view. 44 // The view should be as wide as its parent view.
(...skipping 24 matching lines...) Expand all
67 views::View* time_view_; 69 views::View* time_view_;
68 views::View* status_icon_view_; 70 views::View* status_icon_view_;
69 71
70 DISALLOW_COPY_AND_ASSIGN(SystemInfoView); 72 DISALLOW_COPY_AND_ASSIGN(SystemInfoView);
71 }; 73 };
72 74
73 class SystemUIImpl : public SystemUI { 75 class SystemUIImpl : public SystemUI {
74 public: 76 public:
75 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner) 77 SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner)
76 : orientation_controller_(new OrientationController()), 78 : orientation_controller_(new OrientationController()),
77 background_container_(NULL) { 79 background_container_(NULL),
80 system_modal_container_(NULL) {
78 orientation_controller_->InitWith(blocking_task_runner); 81 orientation_controller_->InitWith(blocking_task_runner);
79 } 82 }
80 83
81 virtual ~SystemUIImpl() { 84 virtual ~SystemUIImpl() {
82 // Stops file watching now if exists. Waiting until message loop shutdon 85 // Stops file watching now if exists. Waiting until message loop shutdon
83 // leads to FilePathWatcher crash. 86 // leads to FilePathWatcher crash.
84 orientation_controller_->Shutdown(); 87 orientation_controller_->Shutdown();
85 } 88 }
86 89
87 void Init() { 90 void Init() {
88 ScreenManager* screen_manager = ScreenManager::Get(); 91 ScreenManager* screen_manager = ScreenManager::Get();
89 background_container_ = screen_manager->CreateContainer( 92 background_container_ = screen_manager->CreateContainer(
90 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND)); 93 ScreenManager::ContainerParams("AthenaBackground", CP_BACKGROUND));
91 background_container_->SetLayoutManager( 94 background_container_->SetLayoutManager(
92 new FillLayoutManager(background_container_)); 95 new FillLayoutManager(background_container_));
96 ScreenManager::ContainerParams system_modal_params(
97 "AthenaSystemModalContainer", CP_SYSTEM_MODAL);
98 system_modal_params.can_activate_children = true;
99 system_modal_container_ =
100 screen_manager->CreateContainer(system_modal_params);
101 login_screen_system_modal_container_ = screen_manager->CreateContainer(
102 ScreenManager::ContainerParams("AthenaLoginScreenSystemModalContainer",
103 CP_LOGIN_SCREEN_SYSTEM_MODAL));
93 104
94 shutdown_dialog_.reset(new ShutdownDialog()); 105 // Use |login_screen_system_modal_container_| for the power button's dialog
106 // because it needs to show over the login screen.
107 // TODO(pkotwicz): Pick the most appropriate container based on whether the
108 // user has logged in.
109 shutdown_dialog_.reset(
110 new ShutdownDialog(login_screen_system_modal_container_));
95 background_controller_.reset( 111 background_controller_.reset(
96 new BackgroundController(background_container_)); 112 new BackgroundController(background_container_));
97 } 113 }
98 114
99 private:
100 // SystemUI:
101 virtual void SetBackgroundImage(const gfx::ImageSkia& image) override { 115 virtual void SetBackgroundImage(const gfx::ImageSkia& image) override {
102 background_controller_->SetImage(image); 116 background_controller_->SetImage(image);
103 } 117 }
104 118
105 virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) override { 119 virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) override {
106 return new SystemInfoView(color_scheme); 120 return new SystemInfoView(color_scheme, system_modal_container_);
107 } 121 }
108 122
123 private:
109 scoped_ptr<OrientationController> orientation_controller_; 124 scoped_ptr<OrientationController> orientation_controller_;
110 scoped_ptr<ShutdownDialog> shutdown_dialog_; 125 scoped_ptr<ShutdownDialog> shutdown_dialog_;
111 scoped_ptr<BackgroundController> background_controller_; 126 scoped_ptr<BackgroundController> background_controller_;
112 127
113 // The parent container for the background. 128 // The parent container for the background.
114 aura::Window* background_container_; 129 aura::Window* background_container_;
115 130
116 // The parent container used by system modal dialogs. 131 // The parent container used by system modal dialogs.
117 aura::Window* system_modal_container_; 132 aura::Window* system_modal_container_;
118 133
(...skipping 22 matching lines...) Expand all
141 } 156 }
142 157
143 // static 158 // static
144 void SystemUI::Shutdown() { 159 void SystemUI::Shutdown() {
145 CHECK(instance); 160 CHECK(instance);
146 delete instance; 161 delete instance;
147 instance = NULL; 162 instance = NULL;
148 } 163 }
149 164
150 } // namespace athena 165 } // namespace athena
OLDNEW
« no previous file with comments | « athena/system/status_icon_container_view.cc ('k') | athena/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698