| 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/accelerators/accelerator_controller.h" | |
| 8 #include "ash/accessibility_delegate.h" | |
| 9 #include "ash/resources/vector_icons/vector_icons.h" | 7 #include "ash/resources/vector_icons/vector_icons.h" |
| 10 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 11 #include "ash/session/session_controller.h" | 9 #include "ash/session/session_controller.h" |
| 12 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| 13 #include "ash/shelf/shelf_constants.h" | 11 #include "ash/shelf/shelf_constants.h" |
| 14 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 15 #include "ash/system/status_area_widget.h" | 13 #include "ash/system/status_area_widget.h" |
| 16 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
| 17 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
| 18 #include "ash/system/tray/tray_bubble_wrapper.h" | 16 #include "ash/system/tray/tray_bubble_wrapper.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 views::TrayBubbleView::InitParams init_params; | 85 views::TrayBubbleView::InitParams init_params; |
| 88 init_params.delegate = tray; | 86 init_params.delegate = tray; |
| 89 init_params.parent_window = anchor_tray->GetBubbleWindowContainer(); | 87 init_params.parent_window = anchor_tray->GetBubbleWindowContainer(); |
| 90 init_params.anchor_view = anchor_tray->GetBubbleAnchor(); | 88 init_params.anchor_view = anchor_tray->GetBubbleAnchor(); |
| 91 init_params.anchor_alignment = tray->GetAnchorAlignment(); | 89 init_params.anchor_alignment = tray->GetAnchorAlignment(); |
| 92 const int width = message_center::kNotificationWidth + | 90 const int width = message_center::kNotificationWidth + |
| 93 message_center::kMarginBetweenItems * 2; | 91 message_center::kMarginBetweenItems * 2; |
| 94 init_params.min_width = width; | 92 init_params.min_width = width; |
| 95 init_params.max_width = width; | 93 init_params.max_width = width; |
| 96 init_params.max_height = bubble->max_height(); | 94 init_params.max_height = bubble->max_height(); |
| 95 init_params.can_activate = true; |
| 97 init_params.bg_color = message_center::kBackgroundDarkColor; | 96 init_params.bg_color = message_center::kBackgroundDarkColor; |
| 98 | 97 |
| 99 views::TrayBubbleView* bubble_view = new views::TrayBubbleView(init_params); | 98 views::TrayBubbleView* bubble_view = new views::TrayBubbleView(init_params); |
| 100 bubble_view->set_anchor_view_insets(anchor_tray->GetBubbleAnchorInsets()); | 99 bubble_view->set_anchor_view_insets(anchor_tray->GetBubbleAnchorInsets()); |
| 101 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_view)); | 100 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_view)); |
| 102 bubble->InitializeContents(bubble_view); | 101 bubble->InitializeContents(bubble_view); |
| 103 } | 102 } |
| 104 | 103 |
| 105 message_center::MessageBubbleBase* bubble() const { return bubble_.get(); } | 104 message_center::MessageBubbleBase* bubble() const { return bubble_.get(); } |
| 106 | 105 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 448 |
| 450 void WebNotificationTray::BubbleViewDestroyed() { | 449 void WebNotificationTray::BubbleViewDestroyed() { |
| 451 if (message_center_bubble()) | 450 if (message_center_bubble()) |
| 452 message_center_bubble()->bubble()->BubbleViewDestroyed(); | 451 message_center_bubble()->bubble()->BubbleViewDestroyed(); |
| 453 } | 452 } |
| 454 | 453 |
| 455 void WebNotificationTray::OnMouseEnteredView() {} | 454 void WebNotificationTray::OnMouseEnteredView() {} |
| 456 | 455 |
| 457 void WebNotificationTray::OnMouseExitedView() {} | 456 void WebNotificationTray::OnMouseExitedView() {} |
| 458 | 457 |
| 459 void WebNotificationTray::RegisterAccelerators( | |
| 460 const std::vector<ui::Accelerator>& accelerators, | |
| 461 views::TrayBubbleView* tray_bubble_view) { | |
| 462 Shell::Get()->accelerator_controller()->Register(accelerators, | |
| 463 tray_bubble_view); | |
| 464 } | |
| 465 | |
| 466 void WebNotificationTray::UnregisterAllAccelerators( | |
| 467 views::TrayBubbleView* tray_bubble_view) { | |
| 468 Shell::Get()->accelerator_controller()->UnregisterAll(tray_bubble_view); | |
| 469 } | |
| 470 | |
| 471 base::string16 WebNotificationTray::GetAccessibleNameForBubble() { | 458 base::string16 WebNotificationTray::GetAccessibleNameForBubble() { |
| 472 return GetAccessibleNameForTray(); | 459 return GetAccessibleNameForTray(); |
| 473 } | 460 } |
| 474 | 461 |
| 475 bool WebNotificationTray::ShouldEnableExtraKeyboardAccessibility() { | |
| 476 return Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); | |
| 477 } | |
| 478 | |
| 479 void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) { | 462 void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) { |
| 480 HideBubbleWithView(bubble_view); | 463 HideBubbleWithView(bubble_view); |
| 481 } | 464 } |
| 482 | 465 |
| 483 bool WebNotificationTray::ShowNotifierSettings() { | 466 bool WebNotificationTray::ShowNotifierSettings() { |
| 484 if (message_center_bubble()) { | 467 if (message_center_bubble()) { |
| 485 static_cast<message_center::MessageCenterBubble*>( | 468 static_cast<message_center::MessageCenterBubble*>( |
| 486 message_center_bubble()->bubble()) | 469 message_center_bubble()->bubble()) |
| 487 ->SetSettingsVisible(); | 470 ->SetSettingsVisible(); |
| 488 return true; | 471 return true; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 598 |
| 616 message_center::MessageCenterBubble* | 599 message_center::MessageCenterBubble* |
| 617 WebNotificationTray::GetMessageCenterBubbleForTest() { | 600 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 618 if (!message_center_bubble()) | 601 if (!message_center_bubble()) |
| 619 return nullptr; | 602 return nullptr; |
| 620 return static_cast<message_center::MessageCenterBubble*>( | 603 return static_cast<message_center::MessageCenterBubble*>( |
| 621 message_center_bubble()->bubble()); | 604 message_center_bubble()->bubble()); |
| 622 } | 605 } |
| 623 | 606 |
| 624 } // namespace ash | 607 } // namespace ash |
| OLD | NEW |