| OLD | NEW |
| 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/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/system/overview/overview_button_tray.h" | 9 #include "ash/common/system/overview/overview_button_tray.h" |
| 10 #include "ash/common/system/status_area_widget_delegate.h" | 10 #include "ash/common/system/status_area_widget_delegate.h" |
| 11 #include "ash/common/system/tray/system_tray.h" | 11 #include "ash/common/system/tray/system_tray.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/system/web_notification/web_notification_tray.h" | 13 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 14 #include "ash/common/wm_lookup.h" | 14 #include "ash/common/wm_lookup.h" |
| 15 #include "ash/common/wm_root_window_controller.h" | 15 #include "ash/common/wm_root_window_controller.h" |
| 16 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
| 17 #include "ash/common/wm_window.h" | 17 #include "ash/common/wm_window.h" |
| 18 #include "base/i18n/time_formatting.h" | 18 #include "base/i18n/time_formatting.h" |
| 19 | 19 |
| 20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 21 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" | 21 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
| 22 #include "ash/common/system/chromeos/palette/palette_tray.h" | 22 #include "ash/common/system/chromeos/palette/palette_tray.h" |
| 23 #include "ash/common/system/chromeos/palette/palette_utils.h" |
| 23 #include "ash/common/system/chromeos/session/logout_button_tray.h" | 24 #include "ash/common/system/chromeos/session/logout_button_tray.h" |
| 24 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 25 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 namespace ash { | 28 namespace ash { |
| 28 | 29 |
| 29 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, | 30 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, |
| 30 WmShelf* wm_shelf) | 31 WmShelf* wm_shelf) |
| 31 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), | 32 : status_area_widget_delegate_(new StatusAreaWidgetDelegate), |
| 32 overview_button_tray_(nullptr), | 33 overview_button_tray_(nullptr), |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 127 } |
| 127 | 128 |
| 128 void StatusAreaWidget::SchedulePaint() { | 129 void StatusAreaWidget::SchedulePaint() { |
| 129 status_area_widget_delegate_->SchedulePaint(); | 130 status_area_widget_delegate_->SchedulePaint(); |
| 130 web_notification_tray_->SchedulePaint(); | 131 web_notification_tray_->SchedulePaint(); |
| 131 system_tray_->SchedulePaint(); | 132 system_tray_->SchedulePaint(); |
| 132 #if defined(OS_CHROMEOS) | 133 #if defined(OS_CHROMEOS) |
| 133 virtual_keyboard_tray_->SchedulePaint(); | 134 virtual_keyboard_tray_->SchedulePaint(); |
| 134 logout_button_tray_->SchedulePaint(); | 135 logout_button_tray_->SchedulePaint(); |
| 135 ime_menu_tray_->SchedulePaint(); | 136 ime_menu_tray_->SchedulePaint(); |
| 136 palette_tray_->SchedulePaint(); | 137 if (palette_tray_) |
| 138 palette_tray_->SchedulePaint(); |
| 137 #endif | 139 #endif |
| 138 overview_button_tray_->SchedulePaint(); | 140 overview_button_tray_->SchedulePaint(); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void StatusAreaWidget::OnNativeWidgetActivationChanged(bool active) { | 143 void StatusAreaWidget::OnNativeWidgetActivationChanged(bool active) { |
| 142 Widget::OnNativeWidgetActivationChanged(active); | 144 Widget::OnNativeWidgetActivationChanged(active); |
| 143 if (active) | 145 if (active) |
| 144 status_area_widget_delegate_->SetPaneFocusAndFocusDefault(); | 146 status_area_widget_delegate_->SetPaneFocusAndFocusDefault(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 void StatusAreaWidget::UpdateShelfItemBackground(int alpha) { | 149 void StatusAreaWidget::UpdateShelfItemBackground(int alpha) { |
| 148 web_notification_tray_->UpdateShelfItemBackground(alpha); | 150 web_notification_tray_->UpdateShelfItemBackground(alpha); |
| 149 system_tray_->UpdateShelfItemBackground(alpha); | 151 system_tray_->UpdateShelfItemBackground(alpha); |
| 150 #if defined(OS_CHROMEOS) | 152 #if defined(OS_CHROMEOS) |
| 151 virtual_keyboard_tray_->UpdateShelfItemBackground(alpha); | 153 virtual_keyboard_tray_->UpdateShelfItemBackground(alpha); |
| 152 logout_button_tray_->UpdateShelfItemBackground(alpha); | 154 logout_button_tray_->UpdateShelfItemBackground(alpha); |
| 153 ime_menu_tray_->UpdateShelfItemBackground(alpha); | 155 ime_menu_tray_->UpdateShelfItemBackground(alpha); |
| 154 palette_tray_->UpdateShelfItemBackground(alpha); | 156 if (palette_tray_) |
| 157 palette_tray_->UpdateShelfItemBackground(alpha); |
| 155 #endif | 158 #endif |
| 156 overview_button_tray_->UpdateShelfItemBackground(alpha); | 159 overview_button_tray_->UpdateShelfItemBackground(alpha); |
| 157 } | 160 } |
| 158 | 161 |
| 159 void StatusAreaWidget::AddSystemTray() { | 162 void StatusAreaWidget::AddSystemTray() { |
| 160 system_tray_ = new SystemTray(wm_shelf_); | 163 system_tray_ = new SystemTray(wm_shelf_); |
| 161 status_area_widget_delegate_->AddTray(system_tray_); | 164 status_area_widget_delegate_->AddTray(system_tray_); |
| 162 } | 165 } |
| 163 | 166 |
| 164 void StatusAreaWidget::AddWebNotificationTray() { | 167 void StatusAreaWidget::AddWebNotificationTray() { |
| 165 DCHECK(system_tray_); | 168 DCHECK(system_tray_); |
| 166 web_notification_tray_ = new WebNotificationTray( | 169 web_notification_tray_ = new WebNotificationTray( |
| 167 wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_); | 170 wm_shelf_, WmLookup::Get()->GetWindowForWidget(this), system_tray_); |
| 168 status_area_widget_delegate_->AddTray(web_notification_tray_); | 171 status_area_widget_delegate_->AddTray(web_notification_tray_); |
| 169 } | 172 } |
| 170 | 173 |
| 171 #if defined(OS_CHROMEOS) | 174 #if defined(OS_CHROMEOS) |
| 172 void StatusAreaWidget::AddLogoutButtonTray() { | 175 void StatusAreaWidget::AddLogoutButtonTray() { |
| 173 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); | 176 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); |
| 174 status_area_widget_delegate_->AddTray(logout_button_tray_); | 177 status_area_widget_delegate_->AddTray(logout_button_tray_); |
| 175 } | 178 } |
| 176 | 179 |
| 177 void StatusAreaWidget::AddPaletteTray() { | 180 void StatusAreaWidget::AddPaletteTray() { |
| 178 palette_tray_ = new PaletteTray(wm_shelf_); | 181 if (IsPaletteFeatureEnabled()) { |
| 179 status_area_widget_delegate_->AddTray(palette_tray_); | 182 palette_tray_ = new PaletteTray(wm_shelf_); |
| 183 status_area_widget_delegate_->AddTray(palette_tray_); |
| 184 } |
| 180 } | 185 } |
| 181 | 186 |
| 182 void StatusAreaWidget::AddVirtualKeyboardTray() { | 187 void StatusAreaWidget::AddVirtualKeyboardTray() { |
| 183 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); | 188 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); |
| 184 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); | 189 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); |
| 185 } | 190 } |
| 186 | 191 |
| 187 void StatusAreaWidget::AddImeMenuTray() { | 192 void StatusAreaWidget::AddImeMenuTray() { |
| 188 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); | 193 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); |
| 189 status_area_widget_delegate_->AddTray(ime_menu_tray_); | 194 status_area_widget_delegate_->AddTray(ime_menu_tray_); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); | 231 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); |
| 227 #if defined(OS_CHROMEOS) | 232 #if defined(OS_CHROMEOS) |
| 228 if (logout_button_tray_) | 233 if (logout_button_tray_) |
| 229 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); | 234 logout_button_tray_->UpdateAfterLoginStatusChange(login_status); |
| 230 #endif | 235 #endif |
| 231 if (overview_button_tray_) | 236 if (overview_button_tray_) |
| 232 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); | 237 overview_button_tray_->UpdateAfterLoginStatusChange(login_status); |
| 233 } | 238 } |
| 234 | 239 |
| 235 } // namespace ash | 240 } // namespace ash |
| OLD | NEW |