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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/system/status_area_widget.cc
diff --git a/ash/common/system/status_area_widget.cc b/ash/common/system/status_area_widget.cc
index 0d95965a196a583603aeebaddb0e24fc68f0cc4e..36d259a081c293000291bf63a8e5718f20509c10 100644
--- a/ash/common/system/status_area_widget.cc
+++ b/ash/common/system/status_area_widget.cc
@@ -4,12 +4,14 @@
#include "ash/common/system/status_area_widget.h"
+#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shell_window_ids.h"
#include "ash/common/system/overview/overview_button_tray.h"
#include "ash/common/system/status_area_widget_delegate.h"
#include "ash/common/system/tray/system_tray.h"
#include "ash/common/system/tray/system_tray_delegate.h"
+#include "ash/common/system/view_observer.h"
#include "ash/common/system/web_notification/web_notification_tray.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_root_window_controller.h"
@@ -155,41 +157,41 @@ void StatusAreaWidget::OnGestureEvent(ui::GestureEvent* event) {
}
void StatusAreaWidget::AddSystemTray() {
- system_tray_ = new SystemTray(wm_shelf_);
+ system_tray_ = new SystemTray(wm_shelf_, this);
status_area_widget_delegate_->AddTray(system_tray_);
}
void StatusAreaWidget::AddWebNotificationTray() {
DCHECK(system_tray_);
web_notification_tray_ = new WebNotificationTray(
- wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_);
+ wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_, this);
status_area_widget_delegate_->AddTray(web_notification_tray_);
}
#if defined(OS_CHROMEOS)
void StatusAreaWidget::AddLogoutButtonTray() {
- logout_button_tray_ = new LogoutButtonTray(wm_shelf_);
+ logout_button_tray_ = new LogoutButtonTray(wm_shelf_, this);
status_area_widget_delegate_->AddTray(logout_button_tray_);
}
void StatusAreaWidget::AddPaletteTray() {
- palette_tray_ = new PaletteTray(wm_shelf_);
+ palette_tray_ = new PaletteTray(wm_shelf_, this);
status_area_widget_delegate_->AddTray(palette_tray_);
}
void StatusAreaWidget::AddVirtualKeyboardTray() {
- virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_);
+ virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_, this);
status_area_widget_delegate_->AddTray(virtual_keyboard_tray_);
}
void StatusAreaWidget::AddImeMenuTray() {
- ime_menu_tray_ = new ImeMenuTray(wm_shelf_);
+ ime_menu_tray_ = new ImeMenuTray(wm_shelf_, this);
status_area_widget_delegate_->AddTray(ime_menu_tray_);
}
#endif
void StatusAreaWidget::AddOverviewButtonTray() {
- overview_button_tray_ = new OverviewButtonTray(wm_shelf_);
+ overview_button_tray_ = new OverviewButtonTray(wm_shelf_, this);
status_area_widget_delegate_->AddTray(overview_button_tray_);
}
@@ -230,4 +232,26 @@ void StatusAreaWidget::UpdateAfterLoginStatusChange(LoginStatus login_status) {
overview_button_tray_->UpdateAfterLoginStatusChange(login_status);
}
+void StatusAreaWidget::OnVisibilityChange(TrayBackgroundView* tray) {
+ if (ash::MaterialDesignController::IsShelfMaterial()) {
+#if defined(OS_CHROMEOS)
+ if (tray == virtual_keyboard_tray_) {
+ if (logout_button_tray_->visible()) {
+ tray->SetSeparatorVisibility(false);
+ } else {
+ tray->SetSeparatorVisibility(true);
+ }
+
+ } else if (tray == ime_menu_tray_) {
+ if (logout_button_tray_->visible() &&
+ !virtual_keyboard_tray_->visible()) {
+ tray->SetSeparatorVisibility(false);
+ } else {
+ tray->SetSeparatorVisibility(true);
+ }
+ }
+#endif
+ }
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698