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

Side by Side Diff: ash/common/system/status_area_widget.cc

Issue 2147143002: [Chrome OS MD] Draw a 1px separator between 2 tray items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new approach Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/system/status_area_widget.h" 5 #include "ash/common/system/status_area_widget.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h"
7 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
8 #include "ash/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/system/overview/overview_button_tray.h" 10 #include "ash/common/system/overview/overview_button_tray.h"
10 #include "ash/common/system/status_area_widget_delegate.h" 11 #include "ash/common/system/status_area_widget_delegate.h"
11 #include "ash/common/system/tray/system_tray.h" 12 #include "ash/common/system/tray/system_tray.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
14 #include "ash/common/system/view_observer.h"
13 #include "ash/common/system/web_notification/web_notification_tray.h" 15 #include "ash/common/system/web_notification/web_notification_tray.h"
14 #include "ash/common/wm_lookup.h" 16 #include "ash/common/wm_lookup.h"
15 #include "ash/common/wm_root_window_controller.h" 17 #include "ash/common/wm_root_window_controller.h"
16 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
17 #include "ash/common/wm_window.h" 19 #include "ash/common/wm_window.h"
18 #include "base/i18n/time_formatting.h" 20 #include "base/i18n/time_formatting.h"
19 21
20 #if defined(OS_CHROMEOS) 22 #if defined(OS_CHROMEOS)
21 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" 23 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h"
22 #include "ash/common/system/chromeos/palette/palette_tray.h" 24 #include "ash/common/system/chromeos/palette/palette_tray.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Widget::OnMouseEvent(event); 150 Widget::OnMouseEvent(event);
149 wm_shelf_->UpdateAutoHideForMouseEvent(event); 151 wm_shelf_->UpdateAutoHideForMouseEvent(event);
150 } 152 }
151 153
152 void StatusAreaWidget::OnGestureEvent(ui::GestureEvent* event) { 154 void StatusAreaWidget::OnGestureEvent(ui::GestureEvent* event) {
153 Widget::OnGestureEvent(event); 155 Widget::OnGestureEvent(event);
154 wm_shelf_->UpdateAutoHideForGestureEvent(event); 156 wm_shelf_->UpdateAutoHideForGestureEvent(event);
155 } 157 }
156 158
157 void StatusAreaWidget::AddSystemTray() { 159 void StatusAreaWidget::AddSystemTray() {
158 system_tray_ = new SystemTray(wm_shelf_); 160 system_tray_ = new SystemTray(wm_shelf_, this);
159 status_area_widget_delegate_->AddTray(system_tray_); 161 status_area_widget_delegate_->AddTray(system_tray_);
160 } 162 }
161 163
162 void StatusAreaWidget::AddWebNotificationTray() { 164 void StatusAreaWidget::AddWebNotificationTray() {
163 DCHECK(system_tray_); 165 DCHECK(system_tray_);
164 web_notification_tray_ = new WebNotificationTray( 166 web_notification_tray_ = new WebNotificationTray(
165 wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_); 167 wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_, this);
166 status_area_widget_delegate_->AddTray(web_notification_tray_); 168 status_area_widget_delegate_->AddTray(web_notification_tray_);
167 } 169 }
168 170
169 #if defined(OS_CHROMEOS) 171 #if defined(OS_CHROMEOS)
170 void StatusAreaWidget::AddLogoutButtonTray() { 172 void StatusAreaWidget::AddLogoutButtonTray() {
171 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); 173 logout_button_tray_ = new LogoutButtonTray(wm_shelf_, this);
172 status_area_widget_delegate_->AddTray(logout_button_tray_); 174 status_area_widget_delegate_->AddTray(logout_button_tray_);
173 } 175 }
174 176
175 void StatusAreaWidget::AddPaletteTray() { 177 void StatusAreaWidget::AddPaletteTray() {
176 palette_tray_ = new PaletteTray(wm_shelf_); 178 palette_tray_ = new PaletteTray(wm_shelf_, this);
177 status_area_widget_delegate_->AddTray(palette_tray_); 179 status_area_widget_delegate_->AddTray(palette_tray_);
178 } 180 }
179 181
180 void StatusAreaWidget::AddVirtualKeyboardTray() { 182 void StatusAreaWidget::AddVirtualKeyboardTray() {
181 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); 183 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_, this);
182 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); 184 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_);
183 } 185 }
184 186
185 void StatusAreaWidget::AddImeMenuTray() { 187 void StatusAreaWidget::AddImeMenuTray() {
186 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); 188 ime_menu_tray_ = new ImeMenuTray(wm_shelf_, this);
187 status_area_widget_delegate_->AddTray(ime_menu_tray_); 189 status_area_widget_delegate_->AddTray(ime_menu_tray_);
188 } 190 }
189 #endif 191 #endif
190 192
191 void StatusAreaWidget::AddOverviewButtonTray() { 193 void StatusAreaWidget::AddOverviewButtonTray() {
192 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); 194 overview_button_tray_ = new OverviewButtonTray(wm_shelf_, this);
193 status_area_widget_delegate_->AddTray(overview_button_tray_); 195 status_area_widget_delegate_->AddTray(overview_button_tray_);
194 } 196 }
195 197
196 void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) { 198 void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) {
197 status_area_widget_delegate_->set_alignment(alignment); 199 status_area_widget_delegate_->set_alignment(alignment);
198 if (system_tray_) 200 if (system_tray_)
199 system_tray_->SetShelfAlignment(alignment); 201 system_tray_->SetShelfAlignment(alignment);
200 if (web_notification_tray_) 202 if (web_notification_tray_)
201 web_notification_tray_->SetShelfAlignment(alignment); 203 web_notification_tray_->SetShelfAlignment(alignment);
202 #if defined(OS_CHROMEOS) 204 #if defined(OS_CHROMEOS)
(...skipping 20 matching lines...) Expand all
223 if (web_notification_tray_) 225 if (web_notification_tray_)
224 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); 226 web_notification_tray_->UpdateAfterLoginStatusChange(login_status);
225 #if defined(OS_CHROMEOS) 227 #if defined(OS_CHROMEOS)
226 if (logout_button_tray_) 228 if (logout_button_tray_)
227 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); 229 logout_button_tray_->UpdateAfterLoginStatusChange(login_status);
228 #endif 230 #endif
229 if (overview_button_tray_) 231 if (overview_button_tray_)
230 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); 232 overview_button_tray_->UpdateAfterLoginStatusChange(login_status);
231 } 233 }
232 234
235 void StatusAreaWidget::OnVisibilityChange(TrayBackgroundView* tray) {
236 if (ash::MaterialDesignController::IsShelfMaterial()) {
237 #if defined(OS_CHROMEOS)
238 if (tray == virtual_keyboard_tray_) {
239 if (logout_button_tray_->visible()) {
240 tray->SetSeparatorVisibility(false);
241 } else {
242 tray->SetSeparatorVisibility(true);
243 }
244
245 } else if (tray == ime_menu_tray_) {
246 if (logout_button_tray_->visible() &&
247 !virtual_keyboard_tray_->visible()) {
248 tray->SetSeparatorVisibility(false);
249 } else {
250 tray->SetSeparatorVisibility(true);
251 }
252 }
253 #endif
254 }
255 }
256
233 } // namespace ash 257 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698