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

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

Issue 10824153: Change Ash web notification behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/status_area_widget.h ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/status_area_widget.h" 5 #include "ash/system/status_area_widget.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h" 9 #include "ash/shell_delegate.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 set_focus_on_creation(false); 291 set_focus_on_creation(false);
292 SetContentsView(widget_delegate_); 292 SetContentsView(widget_delegate_);
293 GetNativeView()->SetName("StatusAreaWidget"); 293 GetNativeView()->SetName("StatusAreaWidget");
294 } 294 }
295 295
296 StatusAreaWidget::~StatusAreaWidget() { 296 StatusAreaWidget::~StatusAreaWidget() {
297 } 297 }
298 298
299 void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) { 299 void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) {
300 AddWebNotificationTray(new WebNotificationTray(this)); 300 AddWebNotificationTray(new WebNotificationTray(this));
301 AddSystemTray(new SystemTray(), shell_delegate); 301 AddSystemTray(new SystemTray(this), shell_delegate);
302 } 302 }
303 303
304 void StatusAreaWidget::Shutdown() { 304 void StatusAreaWidget::Shutdown() {
305 // Destroy the trays early, causing them to be removed from the view 305 // Destroy the trays early, causing them to be removed from the view
306 // hierarchy. Do not used scoped pointers since we don't want to destroy them 306 // hierarchy. Do not used scoped pointers since we don't want to destroy them
307 // in the destructor if Shutdown() is not called (e.g. in tests). 307 // in the destructor if Shutdown() is not called (e.g. in tests).
308 delete system_tray_; 308 delete system_tray_;
309 system_tray_ = NULL; 309 system_tray_ = NULL;
310 delete web_notification_tray_; 310 delete web_notification_tray_;
311 web_notification_tray_ = NULL; 311 web_notification_tray_ = NULL;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 void StatusAreaWidget::SetPaintsBackground( 345 void StatusAreaWidget::SetPaintsBackground(
346 bool value, 346 bool value,
347 internal::BackgroundAnimator::ChangeType change_type) { 347 internal::BackgroundAnimator::ChangeType change_type) {
348 if (system_tray_) 348 if (system_tray_)
349 system_tray_->SetPaintsBackground(value, change_type); 349 system_tray_->SetPaintsBackground(value, change_type);
350 if (web_notification_tray_) 350 if (web_notification_tray_)
351 web_notification_tray_->SetPaintsBackground(value, change_type); 351 web_notification_tray_->SetPaintsBackground(value, change_type);
352 } 352 }
353 353
354 void StatusAreaWidget::ShowWebNotificationBubble(UserAction user_action) { 354 void StatusAreaWidget::HideNonSystemNotifications() {
355 if (system_tray_ && system_tray_->IsBubbleVisible()) { 355 if (web_notification_tray_)
356 // User actions should always hide the system tray bubble first. 356 web_notification_tray_->HideNotificationBubble();
357 DCHECK(user_action != USER_ACTION);
358 // Don't immediately show the web notification bubble if the system tray
359 // bubble is visible.
360 return;
361 }
362 DCHECK(web_notification_tray_);
363 web_notification_tray_->ShowBubble();
364 // Disable showing system notifications while viewing web notifications.
365 if (system_tray_)
366 system_tray_->SetHideNotifications(true);
367 } 357 }
368 358
369 void StatusAreaWidget::HideWebNotificationBubble() { 359 void StatusAreaWidget::SetHideSystemNotifications(bool hide) {
370 DCHECK(web_notification_tray_);
371 web_notification_tray_->HideBubble();
372 // Show any hidden or suppressed system notifications.
373 if (system_tray_) 360 if (system_tray_)
374 system_tray_->SetHideNotifications(false); 361 system_tray_->SetHideNotifications(hide);
362 }
363
364 bool StatusAreaWidget::ShouldShowNonSystemNotifications() {
365 return !(system_tray_ && system_tray_->IsAnyBubbleVisible());
375 } 366 }
376 367
377 void StatusAreaWidget::UpdateAfterLoginStatusChange( 368 void StatusAreaWidget::UpdateAfterLoginStatusChange(
378 user::LoginStatus login_status) { 369 user::LoginStatus login_status) {
379 login_status_ = login_status; 370 login_status_ = login_status;
380 if (system_tray_) 371 if (system_tray_)
381 system_tray_->UpdateAfterLoginStatusChange(login_status); 372 system_tray_->UpdateAfterLoginStatusChange(login_status);
382 if (web_notification_tray_) 373 if (web_notification_tray_)
383 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); 374 web_notification_tray_->UpdateAfterLoginStatusChange(login_status);
384 } 375 }
385 376
386 } // namespace internal 377 } // namespace internal
387 } // namespace ash 378 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget.h ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698