| 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/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_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class WebNotificationBubbleWrapper { | 54 class WebNotificationBubbleWrapper { |
| 55 public: | 55 public: |
| 56 // Takes ownership of |bubble| and creates |bubble_wrapper_|. | 56 // Takes ownership of |bubble| and creates |bubble_wrapper_|. |
| 57 WebNotificationBubbleWrapper(WebNotificationTray* tray, | 57 WebNotificationBubbleWrapper(WebNotificationTray* tray, |
| 58 message_center::MessageBubbleBase* bubble) { | 58 message_center::MessageBubbleBase* bubble) { |
| 59 bubble_.reset(bubble); | 59 bubble_.reset(bubble); |
| 60 views::TrayBubbleView::AnchorAlignment anchor_alignment = | 60 views::TrayBubbleView::AnchorAlignment anchor_alignment = |
| 61 tray->GetAnchorAlignment(); | 61 tray->GetAnchorAlignment(); |
| 62 views::TrayBubbleView::InitParams init_params = | 62 views::TrayBubbleView::InitParams init_params = |
| 63 bubble->GetInitParams(anchor_alignment); | 63 bubble->GetInitParams(anchor_alignment); |
| 64 init_params.close_on_deactivate = false; | |
| 65 views::View* anchor = tray->tray_container(); | 64 views::View* anchor = tray->tray_container(); |
| 66 if (anchor_alignment == views::TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { | 65 if (anchor_alignment == views::TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { |
| 67 gfx::Point bounds(anchor->width() / 2, 0); | 66 gfx::Point bounds(anchor->width() / 2, 0); |
| 68 views::View::ConvertPointToWidget(anchor, &bounds); | 67 views::View::ConvertPointToWidget(anchor, &bounds); |
| 69 init_params.arrow_offset = bounds.x(); | 68 init_params.arrow_offset = bounds.x(); |
| 70 } | 69 } |
| 71 views::TrayBubbleView* bubble_view = views::TrayBubbleView::Create( | 70 views::TrayBubbleView* bubble_view = views::TrayBubbleView::Create( |
| 72 tray->GetBubbleWindowContainer(), anchor, tray, &init_params); | 71 tray->GetBubbleWindowContainer(), anchor, tray, &init_params); |
| 73 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_view)); | 72 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_view)); |
| 74 bubble->InitializeContents(bubble_view); | 73 bubble->InitializeContents(bubble_view); |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 451 |
| 453 message_center::MessagePopupBubble* | 452 message_center::MessagePopupBubble* |
| 454 WebNotificationTray::GetPopupBubbleForTest() { | 453 WebNotificationTray::GetPopupBubbleForTest() { |
| 455 if (!popup_bubble()) | 454 if (!popup_bubble()) |
| 456 return NULL; | 455 return NULL; |
| 457 return static_cast<message_center::MessagePopupBubble*>( | 456 return static_cast<message_center::MessagePopupBubble*>( |
| 458 popup_bubble()->bubble()); | 457 popup_bubble()->bubble()); |
| 459 } | 458 } |
| 460 | 459 |
| 461 } // namespace ash | 460 } // namespace ash |
| OLD | NEW |