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/tray/system_tray_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 void SystemTrayBubble::BubbleViewDestroyed() { | 345 void SystemTrayBubble::BubbleViewDestroyed() { |
346 DestroyItemViews(); | 346 DestroyItemViews(); |
347 bubble_view_ = NULL; | 347 bubble_view_ = NULL; |
348 } | 348 } |
349 | 349 |
350 gfx::Rect SystemTrayBubble::GetAnchorRect() const { | 350 gfx::Rect SystemTrayBubble::GetAnchorRect() const { |
351 gfx::Rect rect; | 351 gfx::Rect rect; |
352 views::Widget* widget = bubble_view()->anchor_widget(); | 352 views::Widget* widget = bubble_view()->anchor_widget(); |
353 if (widget->IsVisible()) { | 353 if (widget->IsVisible()) { |
354 rect = widget->GetWindowScreenBounds(); | 354 rect = widget->GetWindowBoundsInScreen(); |
355 if (anchor_type_ == ANCHOR_TYPE_TRAY) { | 355 if (anchor_type_ == ANCHOR_TYPE_TRAY) { |
356 if (tray_->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { | 356 if (tray_->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { |
357 rect.Inset( | 357 rect.Inset( |
358 base::i18n::IsRTL() ? | 358 base::i18n::IsRTL() ? |
359 kPaddingFromRightEdgeOfScreenBottomAlignment : 0, | 359 kPaddingFromRightEdgeOfScreenBottomAlignment : 0, |
360 0, | 360 0, |
361 base::i18n::IsRTL() ? | 361 base::i18n::IsRTL() ? |
362 0 : kPaddingFromRightEdgeOfScreenBottomAlignment, | 362 0 : kPaddingFromRightEdgeOfScreenBottomAlignment, |
363 kPaddingFromBottomOfScreenBottomAlignment); | 363 kPaddingFromBottomOfScreenBottomAlignment); |
364 } else if (tray_->shelf_alignment() == SHELF_ALIGNMENT_LEFT) { | 364 } else if (tray_->shelf_alignment() == SHELF_ALIGNMENT_LEFT) { |
365 rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment, | 365 rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment, |
366 kPaddingFromBottomOfScreenVerticalAlignment); | 366 kPaddingFromBottomOfScreenVerticalAlignment); |
367 } else { | 367 } else { |
368 rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment, | 368 rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment, |
369 0, 0, kPaddingFromBottomOfScreenVerticalAlignment); | 369 0, 0, kPaddingFromBottomOfScreenVerticalAlignment); |
370 } | 370 } |
371 } else if (anchor_type_ == ANCHOR_TYPE_BUBBLE) { | 371 } else if (anchor_type_ == ANCHOR_TYPE_BUBBLE) { |
372 // For notification bubble to be anchored with uber tray bubble, | 372 // For notification bubble to be anchored with uber tray bubble, |
373 // the anchor can include arrow on left or right, which should | 373 // the anchor can include arrow on left or right, which should |
374 // be deducted out from the anchor rect. | 374 // be deducted out from the anchor rect. |
375 views::View* anchor_view = bubble_view()->anchor_view(); | 375 views::View* anchor_view = bubble_view()->anchor_view(); |
376 rect = anchor_view->GetScreenBounds(); | 376 rect = anchor_view->GetBoundsInScreen(); |
377 gfx::Insets insets = anchor_view->GetInsets(); | 377 gfx::Insets insets = anchor_view->GetInsets(); |
378 rect.Inset(insets); | 378 rect.Inset(insets); |
379 } | 379 } |
380 } | 380 } |
381 return rect; | 381 return rect; |
382 } | 382 } |
383 | 383 |
384 void SystemTrayBubble::OnMouseEnteredView() { | 384 void SystemTrayBubble::OnMouseEnteredView() { |
385 StopAutoCloseTimer(); | 385 StopAutoCloseTimer(); |
386 } | 386 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 473 } |
474 | 474 |
475 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { | 475 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { |
476 CHECK_EQ(bubble_widget_, widget); | 476 CHECK_EQ(bubble_widget_, widget); |
477 bubble_widget_ = NULL; | 477 bubble_widget_ = NULL; |
478 tray_->RemoveBubble(this); | 478 tray_->RemoveBubble(this); |
479 } | 479 } |
480 | 480 |
481 } // namespace internal | 481 } // namespace internal |
482 } // namespace ash | 482 } // namespace ash |
OLD | NEW |