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

Unified Diff: ash/common/system/status_area_widget.cc

Issue 2148573002: Add palette tray to ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stylus-tool-structure
Patch Set: Comments 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 a74c1457e6bd269ad9e3467a79b6e97030e4f72e..7a9d1937348b4aa7098dbd45c9f412113740a151 100644
--- a/ash/common/system/status_area_widget.cc
+++ b/ash/common/system/status_area_widget.cc
@@ -18,6 +18,7 @@
#include "base/i18n/time_formatting.h"
#if defined(OS_CHROMEOS)
+#include "ash/common/system/chromeos/palette/palette_tray.h"
#include "ash/common/system/chromeos/session/logout_button_tray.h"
#include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h"
#endif
@@ -27,12 +28,13 @@ namespace ash {
StatusAreaWidget::StatusAreaWidget(WmWindow* status_container,
WmShelf* wm_shelf)
: status_area_widget_delegate_(new StatusAreaWidgetDelegate),
- overview_button_tray_(NULL),
- system_tray_(NULL),
- web_notification_tray_(NULL),
+ overview_button_tray_(nullptr),
+ system_tray_(nullptr),
+ web_notification_tray_(nullptr),
#if defined(OS_CHROMEOS)
- logout_button_tray_(NULL),
- virtual_keyboard_tray_(NULL),
+ logout_button_tray_(nullptr),
+ palette_tray_(nullptr),
+ virtual_keyboard_tray_(nullptr),
#endif
login_status_(LoginStatus::NOT_LOGGED_IN),
wm_shelf_(wm_shelf) {
@@ -57,6 +59,7 @@ void StatusAreaWidget::CreateTrayViews() {
AddWebNotificationTray();
#if defined(OS_CHROMEOS)
AddLogoutButtonTray();
+ AddPaletteTray();
AddVirtualKeyboardTray();
#endif
@@ -80,18 +83,18 @@ void StatusAreaWidget::Shutdown() {
// hierarchy. Do not used scoped pointers since we don't want to destroy them
// in the destructor if Shutdown() is not called (e.g. in tests).
delete web_notification_tray_;
- web_notification_tray_ = NULL;
+ web_notification_tray_ = nullptr;
// Must be destroyed after |web_notification_tray_|.
delete system_tray_;
- system_tray_ = NULL;
+ system_tray_ = nullptr;
#if defined(OS_CHROMEOS)
delete virtual_keyboard_tray_;
- virtual_keyboard_tray_ = NULL;
+ virtual_keyboard_tray_ = nullptr;
delete logout_button_tray_;
- logout_button_tray_ = NULL;
+ logout_button_tray_ = nullptr;
#endif
delete overview_button_tray_;
- overview_button_tray_ = NULL;
+ overview_button_tray_ = nullptr;
}
bool StatusAreaWidget::ShouldShowShelf() const {
@@ -123,6 +126,7 @@ void StatusAreaWidget::SchedulePaint() {
#if defined(OS_CHROMEOS)
virtual_keyboard_tray_->SchedulePaint();
logout_button_tray_->SchedulePaint();
+ palette_tray_->SchedulePaint();
#endif
overview_button_tray_->SchedulePaint();
}
@@ -161,6 +165,11 @@ void StatusAreaWidget::AddLogoutButtonTray() {
status_area_widget_delegate_->AddTray(logout_button_tray_);
}
+void StatusAreaWidget::AddPaletteTray() {
+ palette_tray_ = new PaletteTray(wm_shelf_);
+ status_area_widget_delegate_->AddTray(palette_tray_);
+}
+
void StatusAreaWidget::AddVirtualKeyboardTray() {
virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_);
status_area_widget_delegate_->AddTray(virtual_keyboard_tray_);
@@ -183,6 +192,8 @@ void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) {
logout_button_tray_->SetShelfAlignment(alignment);
if (virtual_keyboard_tray_)
virtual_keyboard_tray_->SetShelfAlignment(alignment);
+ if (palette_tray_)
+ palette_tray_->SetShelfAlignment(alignment);
#endif
if (overview_button_tray_)
overview_button_tray_->SetShelfAlignment(alignment);

Powered by Google App Engine
This is Rietveld 408576698