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

Unified Diff: ash/system/status_area_widget.cc

Issue 10546125: Add WebNotificationTray to the status area (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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/system/status_area_widget.cc
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc
index f0ae1d011962800493d8f33a8df2a7e57476aafe..c83ced0336429b38a8ee8fb2f71edde59507e4e2 100644
--- a/ash/system/status_area_widget.cc
+++ b/ash/system/status_area_widget.cc
@@ -12,6 +12,7 @@
#include "ash/system/status_area_widget_delegate.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/system/web_notification/web_notification_tray.h"
#include "base/i18n/time_formatting.h"
#include "base/utf_string_conversions.h"
#include "ui/aura/window.h"
@@ -281,7 +282,8 @@ namespace internal {
StatusAreaWidget::StatusAreaWidget()
: widget_delegate_(new internal::StatusAreaWidgetDelegate),
- system_tray_(NULL) {
+ system_tray_(NULL),
+ web_notification_tray_(NULL) {
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.delegate = widget_delegate_;
@@ -299,6 +301,7 @@ StatusAreaWidget::~StatusAreaWidget() {
}
void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) {
+ AddWebNotificationTray(new WebNotificationTray(this));
AddSystemTray(new SystemTray(), shell_delegate);
}
@@ -308,6 +311,8 @@ void StatusAreaWidget::Shutdown() {
// in the destructor if Shutdown() is not called (e.g. in tests).
delete system_tray_;
system_tray_ = NULL;
+ delete web_notification_tray_;
+ web_notification_tray_ = NULL;
}
void StatusAreaWidget::AddSystemTray(SystemTray* system_tray,
@@ -326,9 +331,50 @@ void StatusAreaWidget::AddSystemTray(SystemTray* system_tray,
system_tray->CreateItems(); // Called after delegate is created.
}
+void StatusAreaWidget::AddWebNotificationTray(
+ WebNotificationTray* web_notification_tray) {
+ web_notification_tray_ = web_notification_tray;
+ widget_delegate_->AddTray(web_notification_tray);
+}
+
void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) {
widget_delegate_->set_alignment(alignment);
widget_delegate_->UpdateLayout();
+ if (system_tray_)
+ system_tray_->SetShelfAlignment(alignment);
+ if (web_notification_tray_)
+ web_notification_tray_->SetShelfAlignment(alignment);
+}
+
+void StatusAreaWidget::SetPaintsBackground(
+ bool value,
sadrul 2012/06/13 16:37:56 less indentation
stevenjb 2012/06/13 19:05:02 Done.
+ internal::BackgroundAnimator::ChangeType change_type) {
+ if (system_tray_)
+ system_tray_->SetPaintsBackground(value, change_type);
+ if (web_notification_tray_)
+ web_notification_tray_->SetPaintsBackground(value, change_type);
+}
+
+void StatusAreaWidget::ShowWebNotificationBubble(UserAction user_action) {
+ // If not triggered by a user action, only show the web notification bubble
+ // if the system tray is not visible.
+ if (user_action == USER_ACTION &&
+ system_tray_ && system_tray_->IsBubbleVisible()) {
+ return;
+ }
+ DCHECK(web_notification_tray_);
+ web_notification_tray_->ShowBubble();
+ // Disable showing system notifications while viewing web notifications.
+ if (system_tray_)
+ system_tray_->SetHideNotifications(true);
sadrul 2012/06/13 16:37:56 Just to clarify: with this change, both the system
stevenjb 2012/06/13 19:05:02 No, only one should be visible at a time, but that
+}
+
+void StatusAreaWidget::HideWebNotificationBubble() {
+ DCHECK(web_notification_tray_);
+ web_notification_tray_->HideBubble();
+ // Show any hidden or suppressed system notifications.
+ if (system_tray_)
+ system_tray_->SetHideNotifications(false);
}
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698