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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

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

Powered by Google App Engine
This is Rietveld 408576698