| 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/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_layout_manager_observer.h" | 10 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
| 14 #include "ash/system/status_area_widget.h" | 14 #include "ash/system/status_area_widget.h" |
| 15 #include "ash/system/tray/system_tray.h" | 15 #include "ash/system/tray/system_tray.h" |
| 16 #include "ash/system/tray/tray_background_view.h" | 16 #include "ash/system/tray/tray_background_view.h" |
| 17 #include "ash/system/tray/tray_bubble_wrapper.h" | 17 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 18 #include "ash/system/tray/tray_constants.h" | 18 #include "ash/system/tray/tray_constants.h" |
| 19 #include "ash/system/tray/tray_utils.h" | 19 #include "ash/system/tray/tray_utils.h" |
| 20 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" | 20 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
| 21 #include "base/auto_reset.h" | 21 #include "base/auto_reset.h" |
| 22 #include "base/i18n/number_formatting.h" | 22 #include "base/i18n/number_formatting.h" |
| 23 #include "base/i18n/rtl.h" | 23 #include "base/i18n/rtl.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/thread_task_runner_handle.h" |
| 25 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
| 26 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| 27 #include "ui/aura/window_event_dispatcher.h" | 28 #include "ui/aura/window_event_dispatcher.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
| 30 #include "ui/message_center/message_center_style.h" | 31 #include "ui/message_center/message_center_style.h" |
| 31 #include "ui/message_center/message_center_tray_delegate.h" | 32 #include "ui/message_center/message_center_tray_delegate.h" |
| 32 #include "ui/message_center/views/message_bubble_base.h" | 33 #include "ui/message_center/views/message_bubble_base.h" |
| 33 #include "ui/message_center/views/message_center_bubble.h" | 34 #include "ui/message_center/views/message_center_bubble.h" |
| 34 #include "ui/message_center/views/message_popup_collection.h" | 35 #include "ui/message_center/views/message_popup_collection.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 const ui::Event& event) { | 438 const ui::Event& event) { |
| 438 DCHECK_EQ(button_, sender); | 439 DCHECK_EQ(button_, sender); |
| 439 PerformAction(event); | 440 PerformAction(event); |
| 440 } | 441 } |
| 441 | 442 |
| 442 void WebNotificationTray::OnMessageCenterTrayChanged() { | 443 void WebNotificationTray::OnMessageCenterTrayChanged() { |
| 443 // Do not update the tray contents directly. Multiple change events can happen | 444 // Do not update the tray contents directly. Multiple change events can happen |
| 444 // consecutively, and calling Update in the middle of those events will show | 445 // consecutively, and calling Update in the middle of those events will show |
| 445 // intermediate unread counts for a moment. | 446 // intermediate unread counts for a moment. |
| 446 should_update_tray_content_ = true; | 447 should_update_tray_content_ = true; |
| 447 base::MessageLoop::current()->PostTask( | 448 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 448 FROM_HERE, | 449 FROM_HERE, |
| 449 base::Bind(&WebNotificationTray::UpdateTrayContent, AsWeakPtr())); | 450 base::Bind(&WebNotificationTray::UpdateTrayContent, AsWeakPtr())); |
| 450 } | 451 } |
| 451 | 452 |
| 452 void WebNotificationTray::UpdateTrayContent() { | 453 void WebNotificationTray::UpdateTrayContent() { |
| 453 if (!should_update_tray_content_) | 454 if (!should_update_tray_content_) |
| 454 return; | 455 return; |
| 455 should_update_tray_content_ = false; | 456 should_update_tray_content_ = false; |
| 456 | 457 |
| 457 message_center::MessageCenter* message_center = | 458 message_center::MessageCenter* message_center = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 494 |
| 494 message_center::MessageCenterBubble* | 495 message_center::MessageCenterBubble* |
| 495 WebNotificationTray::GetMessageCenterBubbleForTest() { | 496 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 496 if (!message_center_bubble()) | 497 if (!message_center_bubble()) |
| 497 return NULL; | 498 return NULL; |
| 498 return static_cast<message_center::MessageCenterBubble*>( | 499 return static_cast<message_center::MessageCenterBubble*>( |
| 499 message_center_bubble()->bubble()); | 500 message_center_bubble()->bubble()); |
| 500 } | 501 } |
| 501 | 502 |
| 502 } // namespace ash | 503 } // namespace ash |
| OLD | NEW |