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.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell/panel_window.h" | 8 #include "ash/shell/panel_window.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
11 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
12 #include "ash/system/tray/system_tray_item.h" | 12 #include "ash/system/tray/system_tray_item.h" |
13 #include "ash/system/user/login_status.h" | 13 #include "ash/system/user/login_status.h" |
14 #include "ash/wm/shadow_types.h" | 14 #include "ash/wm/shadow_types.h" |
| 15 #include "ash/wm/shelf_layout_manager.h" |
15 #include "ash/wm/window_animations.h" | 16 #include "ash/wm/window_animations.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/timer.h" | 18 #include "base/timer.h" |
18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
19 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
20 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
21 #include "third_party/skia/include/core/SkPaint.h" | 22 #include "third_party/skia/include/core/SkPaint.h" |
22 #include "third_party/skia/include/core/SkPath.h" | 23 #include "third_party/skia/include/core/SkPath.h" |
23 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
24 #include "ui/gfx/skia_util.h" | 25 #include "ui/gfx/skia_util.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 520 |
520 // Setup animation. | 521 // Setup animation. |
521 ash::SetWindowVisibilityAnimationType(popup_->GetNativeWindow(), | 522 ash::SetWindowVisibilityAnimationType(popup_->GetNativeWindow(), |
522 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 523 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
523 ash::SetWindowVisibilityAnimationTransition(popup_->GetNativeWindow(), | 524 ash::SetWindowVisibilityAnimationTransition(popup_->GetNativeWindow(), |
524 ash::ANIMATE_BOTH); | 525 ash::ANIMATE_BOTH); |
525 ash::SetWindowVisibilityAnimationDuration(popup_->GetNativeWindow(), | 526 ash::SetWindowVisibilityAnimationDuration(popup_->GetNativeWindow(), |
526 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS)); | 527 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS)); |
527 | 528 |
528 bubble_->Show(); | 529 bubble_->Show(); |
| 530 |
| 531 Shell::GetInstance()->shelf()->UpdateAutoHideState(); |
529 } | 532 } |
530 | 533 |
531 bool SystemTray::OnKeyPressed(const views::KeyEvent& event) { | 534 bool SystemTray::OnKeyPressed(const views::KeyEvent& event) { |
532 if (event.key_code() == ui::VKEY_SPACE || | 535 if (event.key_code() == ui::VKEY_SPACE || |
533 event.key_code() == ui::VKEY_RETURN) { | 536 event.key_code() == ui::VKEY_RETURN) { |
534 if (popup_) | 537 if (popup_) |
535 popup_->Hide(); | 538 popup_->Hide(); |
536 else | 539 else |
537 ShowItems(items_.get(), false, true); | 540 ShowItems(items_.get(), false, true); |
538 return true; | 541 return true; |
(...skipping 27 matching lines...) Expand all Loading... |
566 | 569 |
567 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { | 570 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { |
568 if (GetWidget() && GetWidget()->IsActive()) | 571 if (GetWidget() && GetWidget()->IsActive()) |
569 views::View::OnPaintFocusBorder(canvas); | 572 views::View::OnPaintFocusBorder(canvas); |
570 } | 573 } |
571 | 574 |
572 void SystemTray::OnWidgetClosing(views::Widget* widget) { | 575 void SystemTray::OnWidgetClosing(views::Widget* widget) { |
573 CHECK_EQ(popup_, widget); | 576 CHECK_EQ(popup_, widget); |
574 popup_ = NULL; | 577 popup_ = NULL; |
575 bubble_ = NULL; | 578 bubble_ = NULL; |
| 579 Shell::GetInstance()->shelf()->UpdateAutoHideState(); |
576 } | 580 } |
577 | 581 |
578 void SystemTray::UpdateBackground(int alpha) { | 582 void SystemTray::UpdateBackground(int alpha) { |
579 if (mouse_in_tray_) | 583 if (mouse_in_tray_) |
580 alpha += kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha; | 584 alpha += kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha; |
581 background_->set_alpha(alpha); | 585 background_->set_alpha(alpha); |
582 SchedulePaint(); | 586 SchedulePaint(); |
583 } | 587 } |
584 | 588 |
585 } // namespace ash | 589 } // namespace ash |
OLD | NEW |