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/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const int kShadowThickness = 4; | 36 const int kShadowThickness = 4; |
37 | 37 |
38 const int kBottomLineHeight = 1; | 38 const int kBottomLineHeight = 1; |
39 | 39 |
40 const int kSystemTrayBubbleHorizontalInset = 1; | 40 const int kSystemTrayBubbleHorizontalInset = 1; |
41 const int kSystemTrayBubbleVerticalInset = 1; | 41 const int kSystemTrayBubbleVerticalInset = 1; |
42 | 42 |
43 const int kArrowHeight = 10; | 43 const int kArrowHeight = 10; |
44 const int kArrowWidth = 20; | 44 const int kArrowWidth = 20; |
45 const int kArrowPaddingFromRight = 20; | 45 const int kArrowPaddingFromRight = 20; |
| 46 const int kArrowPaddingFromBottom = 17; |
46 const int kMinArrowOffset = 12; | 47 const int kMinArrowOffset = 12; |
47 | 48 |
48 const int kAnimationDurationForPopupMS = 200; | 49 const int kAnimationDurationForPopupMS = 200; |
49 | 50 |
50 const SkColor kShadowColor = SkColorSetARGB(0xff, 0, 0, 0); | 51 const SkColor kShadowColor = SkColorSetARGB(0xff, 0, 0, 0); |
51 | 52 |
52 void DrawBlurredShadowAroundView(gfx::Canvas* canvas, | 53 void DrawBlurredShadowAroundView(gfx::Canvas* canvas, |
53 int top, | 54 int top, |
54 int bottom, | 55 int bottom, |
55 int width, | 56 int width, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 host_->StopAutoCloseTimer(); | 344 host_->StopAutoCloseTimer(); |
344 } | 345 } |
345 | 346 |
346 void SystemTrayBubbleView::OnMouseExited(const views::MouseEvent& event) { | 347 void SystemTrayBubbleView::OnMouseExited(const views::MouseEvent& event) { |
347 if (host_) | 348 if (host_) |
348 host_->RestartAutoCloseTimer(); | 349 host_->RestartAutoCloseTimer(); |
349 } | 350 } |
350 | 351 |
351 // SystemTrayBubble::InitParams | 352 // SystemTrayBubble::InitParams |
352 SystemTrayBubble::InitParams::InitParams( | 353 SystemTrayBubble::InitParams::InitParams( |
353 SystemTrayBubble::AnchorType anchor_type) | 354 SystemTrayBubble::AnchorType anchor_type, |
| 355 ShelfAlignment shelf_alignment) |
354 : anchor(NULL), | 356 : anchor(NULL), |
355 anchor_type(anchor_type), | 357 anchor_type(anchor_type), |
356 can_activate(false), | 358 can_activate(false), |
357 login_status(ash::user::LOGGED_IN_NONE), | 359 login_status(ash::user::LOGGED_IN_NONE), |
358 arrow_offset(kArrowPaddingFromRight + kArrowWidth / 2) { | 360 arrow_offset( |
| 361 (shelf_alignment == SHELF_ALIGNMENT_BOTTOM ? |
| 362 kArrowPaddingFromRight : kArrowPaddingFromBottom) |
| 363 + kArrowWidth / 2) { |
359 } | 364 } |
360 | 365 |
361 // SystemTrayBubble | 366 // SystemTrayBubble |
362 | 367 |
363 SystemTrayBubble::SystemTrayBubble( | 368 SystemTrayBubble::SystemTrayBubble( |
364 ash::SystemTray* tray, | 369 ash::SystemTray* tray, |
365 const std::vector<ash::SystemTrayItem*>& items, | 370 const std::vector<ash::SystemTrayItem*>& items, |
366 BubbleType bubble_type) | 371 BubbleType bubble_type) |
367 : tray_(tray), | 372 : tray_(tray), |
368 bubble_view_(NULL), | 373 bubble_view_(NULL), |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 void SystemTrayBubble::OnWidgetVisibilityChanged(views::Widget* widget, | 580 void SystemTrayBubble::OnWidgetVisibilityChanged(views::Widget* widget, |
576 bool visible) { | 581 bool visible) { |
577 if (!visible) | 582 if (!visible) |
578 MessageLoopForUI::current()->RemoveObserver(this); | 583 MessageLoopForUI::current()->RemoveObserver(this); |
579 else | 584 else |
580 MessageLoopForUI::current()->AddObserver(this); | 585 MessageLoopForUI::current()->AddObserver(this); |
581 } | 586 } |
582 | 587 |
583 } // namespace internal | 588 } // namespace internal |
584 } // namespace ash | 589 } // namespace ash |
OLD | NEW |