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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
25 #include "third_party/skia/include/core/SkPaint.h" | 25 #include "third_party/skia/include/core/SkPaint.h" |
26 #include "third_party/skia/include/core/SkPath.h" | 26 #include "third_party/skia/include/core/SkPath.h" |
27 #include "ui/aura/root_window.h" | 27 #include "ui/aura/root_window.h" |
28 #include "ui/base/events.h" | 28 #include "ui/base/events.h" |
29 #include "ui/base/accessibility/accessible_view_state.h" | 29 #include "ui/base/accessibility/accessible_view_state.h" |
30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/gfx/canvas.h" | 31 #include "ui/gfx/canvas.h" |
32 #include "ui/gfx/screen.h" | 32 #include "ui/gfx/screen.h" |
33 #include "ui/gfx/skia_util.h" | 33 #include "ui/gfx/skia_util.h" |
| 34 #include "ui/views/accessible_pane_view.h" |
34 #include "ui/views/border.h" | 35 #include "ui/views/border.h" |
35 #include "ui/views/bubble/bubble_delegate.h" | 36 #include "ui/views/bubble/bubble_delegate.h" |
36 #include "ui/views/controls/label.h" | 37 #include "ui/views/controls/label.h" |
37 #include "ui/views/layout/fill_layout.h" | 38 #include "ui/views/layout/fill_layout.h" |
38 #include "ui/views/layout/box_layout.h" | 39 #include "ui/views/layout/box_layout.h" |
39 #include "ui/views/view.h" | 40 #include "ui/views/view.h" |
40 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
41 | 42 |
42 namespace ash { | 43 namespace ash { |
43 | 44 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 clock_observer_(NULL), | 454 clock_observer_(NULL), |
454 ime_observer_(NULL), | 455 ime_observer_(NULL), |
455 network_observer_(NULL), | 456 network_observer_(NULL), |
456 power_status_observer_(NULL), | 457 power_status_observer_(NULL), |
457 update_observer_(NULL), | 458 update_observer_(NULL), |
458 user_observer_(NULL), | 459 user_observer_(NULL), |
459 bubble_(NULL), | 460 bubble_(NULL), |
460 popup_(NULL), | 461 popup_(NULL), |
461 background_(new internal::SystemTrayBackground), | 462 background_(new internal::SystemTrayBackground), |
462 should_show_launcher_(false), | 463 should_show_launcher_(false), |
| 464 taking_focus_(false), |
463 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(this, | 465 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(this, |
464 0, kTrayBackgroundAlpha)), | 466 0, kTrayBackgroundAlpha)), |
465 ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_(this, | 467 ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_(this, |
466 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)) { | 468 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)) { |
467 container_ = new views::View; | 469 container_ = new views::View; |
468 container_->SetLayoutManager(new views::BoxLayout( | 470 container_->SetLayoutManager(new views::BoxLayout( |
469 views::BoxLayout::kHorizontal, 0, 0, 0)); | 471 views::BoxLayout::kHorizontal, 0, 0, 0)); |
470 container_->set_background(background_); | 472 container_->set_background(background_); |
471 container_->set_border( | 473 container_->set_border( |
472 views::Border::CreateEmptyBorder(1, 1, 1, 1)); | 474 views::Border::CreateEmptyBorder(1, 1, 1, 1)); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 SetVisible(true); | 564 SetVisible(true); |
563 PreferredSizeChanged(); | 565 PreferredSizeChanged(); |
564 } | 566 } |
565 | 567 |
566 void SystemTray::SetPaintsBackground( | 568 void SystemTray::SetPaintsBackground( |
567 bool value, | 569 bool value, |
568 internal::BackgroundAnimator::ChangeType change_type) { | 570 internal::BackgroundAnimator::ChangeType change_type) { |
569 hide_background_animator_.SetPaintsBackground(value, change_type); | 571 hide_background_animator_.SetPaintsBackground(value, change_type); |
570 } | 572 } |
571 | 573 |
| 574 void SystemTray::TakeFocus(View* next_focusable_view) { |
| 575 taking_focus_ = true; |
| 576 views::AccessiblePaneView* view = |
| 577 static_cast<views::AccessiblePaneView*>(GetWidget()->GetContentsView()); |
| 578 view->SetPaneFocusAndFocusDefault(); |
| 579 GetWidget()->Activate(); |
| 580 |
| 581 SetNextFocusableView(next_focusable_view); |
| 582 taking_focus_ = false; |
| 583 } |
| 584 |
572 void SystemTray::ShowItems(std::vector<SystemTrayItem*>& items, | 585 void SystemTray::ShowItems(std::vector<SystemTrayItem*>& items, |
573 bool detailed, | 586 bool detailed, |
574 bool activate) { | 587 bool activate) { |
575 CHECK(!popup_); | 588 CHECK(!popup_); |
576 CHECK(!bubble_); | 589 CHECK(!bubble_); |
577 bubble_ = new internal::SystemTrayBubble(this, container_, items, detailed); | 590 bubble_ = new internal::SystemTrayBubble(this, container_, items, detailed); |
578 bubble_->set_can_activate(activate); | 591 bubble_->set_can_activate(activate); |
579 popup_ = views::BubbleDelegateView::CreateBubble(bubble_); | 592 popup_ = views::BubbleDelegateView::CreateBubble(bubble_); |
580 // If we have focus the shelf should be visible and we need to continue | 593 // If we have focus the shelf should be visible and we need to continue |
581 // showing the shelf when the popup is shown. | 594 // showing the shelf when the popup is shown. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 popup_->Hide(); | 694 popup_->Hide(); |
682 } | 695 } |
683 } | 696 } |
684 return base::EVENT_CONTINUE; | 697 return base::EVENT_CONTINUE; |
685 } | 698 } |
686 | 699 |
687 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { | 700 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { |
688 } | 701 } |
689 | 702 |
690 } // namespace ash | 703 } // namespace ash |
OLD | NEW |