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/audio/tray_volume.h" | 10 #include "ash/system/audio/tray_volume.h" |
11 #include "ash/system/bluetooth/tray_bluetooth.h" | 11 #include "ash/system/bluetooth/tray_bluetooth.h" |
12 #include "ash/system/brightness/tray_brightness.h" | 12 #include "ash/system/brightness/tray_brightness.h" |
13 #include "ash/system/date/tray_date.h" | 13 #include "ash/system/date/tray_date.h" |
14 #include "ash/system/drive/tray_drive.h" | |
15 #include "ash/system/ime/tray_ime.h" | 14 #include "ash/system/ime/tray_ime.h" |
16 #include "ash/system/network/tray_network.h" | 15 #include "ash/system/network/tray_network.h" |
17 #include "ash/system/power/power_status_observer.h" | 16 #include "ash/system/power/power_status_observer.h" |
18 #include "ash/system/power/power_supply_status.h" | 17 #include "ash/system/power/power_supply_status.h" |
19 #include "ash/system/power/tray_power.h" | 18 #include "ash/system/power/tray_power.h" |
20 #include "ash/system/settings/tray_settings.h" | 19 #include "ash/system/settings/tray_settings.h" |
21 #include "ash/system/tray/tray_empty.h" | 20 #include "ash/system/tray/tray_empty.h" |
22 #include "ash/system/tray/tray_constants.h" | 21 #include "ash/system/tray/tray_constants.h" |
23 #include "ash/system/tray/system_tray_delegate.h" | 22 #include "ash/system/tray/system_tray_delegate.h" |
24 #include "ash/system/tray/system_tray_item.h" | 23 #include "ash/system/tray/system_tray_item.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 private: | 130 private: |
132 // Overridden from views::View. | 131 // Overridden from views::View. |
133 virtual void ChildVisibilityChanged(View* child) OVERRIDE { | 132 virtual void ChildVisibilityChanged(View* child) OVERRIDE { |
134 if (visible() == child->visible()) | 133 if (visible() == child->visible()) |
135 return; | 134 return; |
136 SetVisible(child->visible()); | 135 SetVisible(child->visible()); |
137 PreferredSizeChanged(); | 136 PreferredSizeChanged(); |
138 } | 137 } |
139 | 138 |
140 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE { | |
141 PreferredSizeChanged(); | |
142 } | |
143 | |
144 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE { | 139 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE { |
145 hover_ = true; | 140 hover_ = true; |
146 SchedulePaint(); | 141 SchedulePaint(); |
147 } | 142 } |
148 | 143 |
149 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE { | 144 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE { |
150 hover_ = false; | 145 hover_ = false; |
151 SchedulePaint(); | 146 SchedulePaint(); |
152 } | 147 } |
153 | 148 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 void SystemTrayBubble::OnWidgetVisibilityChanged(views::Widget* widget, | 598 void SystemTrayBubble::OnWidgetVisibilityChanged(views::Widget* widget, |
604 bool visible) { | 599 bool visible) { |
605 if (!visible) | 600 if (!visible) |
606 MessageLoopForUI::current()->RemoveObserver(this); | 601 MessageLoopForUI::current()->RemoveObserver(this); |
607 else | 602 else |
608 MessageLoopForUI::current()->AddObserver(this); | 603 MessageLoopForUI::current()->AddObserver(this); |
609 } | 604 } |
610 | 605 |
611 } // namespace internal | 606 } // namespace internal |
612 | 607 |
| 608 // From system_tray_delegate.h |
| 609 |
| 610 NetworkIconInfo::NetworkIconInfo() |
| 611 : highlight(false), |
| 612 tray_icon_visible(true) { |
| 613 } |
| 614 |
| 615 NetworkIconInfo::~NetworkIconInfo() { |
| 616 } |
| 617 |
| 618 BluetoothDeviceInfo::BluetoothDeviceInfo() |
| 619 : connected(false) { |
| 620 } |
| 621 |
| 622 BluetoothDeviceInfo::~BluetoothDeviceInfo() { |
| 623 } |
| 624 |
| 625 IMEInfo::IMEInfo() |
| 626 : selected(false) { |
| 627 } |
| 628 |
| 629 IMEInfo::~IMEInfo() { |
| 630 } |
| 631 |
| 632 IMEPropertyInfo::IMEPropertyInfo() |
| 633 : selected(false) { |
| 634 } |
| 635 |
| 636 IMEPropertyInfo::~IMEPropertyInfo() { |
| 637 } |
| 638 |
613 // SystemTray | 639 // SystemTray |
614 | 640 |
615 SystemTray::SystemTray() | 641 SystemTray::SystemTray() |
616 : items_(), | 642 : items_(), |
617 accessibility_observer_(NULL), | 643 accessibility_observer_(NULL), |
618 audio_observer_(NULL), | 644 audio_observer_(NULL), |
619 bluetooth_observer_(NULL), | 645 bluetooth_observer_(NULL), |
620 brightness_observer_(NULL), | 646 brightness_observer_(NULL), |
621 caps_lock_observer_(NULL), | 647 caps_lock_observer_(NULL), |
622 clock_observer_(NULL), | 648 clock_observer_(NULL), |
623 drive_observer_(NULL), | |
624 ime_observer_(NULL), | 649 ime_observer_(NULL), |
625 network_observer_(NULL), | 650 network_observer_(NULL), |
626 power_status_observer_(NULL), | 651 power_status_observer_(NULL), |
627 update_observer_(NULL), | 652 update_observer_(NULL), |
628 user_observer_(NULL), | 653 user_observer_(NULL), |
629 widget_(NULL), | 654 widget_(NULL), |
630 background_(new internal::SystemTrayBackground), | 655 background_(new internal::SystemTrayBackground), |
631 should_show_launcher_(false), | 656 should_show_launcher_(false), |
632 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(this, | 657 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(this, |
633 0, kTrayBackgroundAlpha)), | 658 0, kTrayBackgroundAlpha)), |
(...skipping 30 matching lines...) Expand all Loading... |
664 internal::TrayVolume* tray_volume = new internal::TrayVolume(); | 689 internal::TrayVolume* tray_volume = new internal::TrayVolume(); |
665 internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth(); | 690 internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth(); |
666 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); | 691 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); |
667 internal::TrayDate* tray_date = new internal::TrayDate(); | 692 internal::TrayDate* tray_date = new internal::TrayDate(); |
668 internal::TrayPower* tray_power = new internal::TrayPower(); | 693 internal::TrayPower* tray_power = new internal::TrayPower(); |
669 internal::TrayNetwork* tray_network = new internal::TrayNetwork; | 694 internal::TrayNetwork* tray_network = new internal::TrayNetwork; |
670 internal::TrayUser* tray_user = new internal::TrayUser; | 695 internal::TrayUser* tray_user = new internal::TrayUser; |
671 internal::TrayAccessibility* tray_accessibility = | 696 internal::TrayAccessibility* tray_accessibility = |
672 new internal::TrayAccessibility; | 697 new internal::TrayAccessibility; |
673 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock; | 698 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock; |
674 internal::TrayDrive* tray_drive = new internal::TrayDrive; | |
675 internal::TrayIME* tray_ime = new internal::TrayIME; | 699 internal::TrayIME* tray_ime = new internal::TrayIME; |
676 internal::TrayUpdate* tray_update = new internal::TrayUpdate; | 700 internal::TrayUpdate* tray_update = new internal::TrayUpdate; |
677 | 701 |
678 accessibility_observer_ = tray_accessibility; | 702 accessibility_observer_ = tray_accessibility; |
679 audio_observer_ = tray_volume; | 703 audio_observer_ = tray_volume; |
680 bluetooth_observer_ = tray_bluetooth; | 704 bluetooth_observer_ = tray_bluetooth; |
681 brightness_observer_ = tray_brightness; | 705 brightness_observer_ = tray_brightness; |
682 caps_lock_observer_ = tray_caps_lock; | 706 caps_lock_observer_ = tray_caps_lock; |
683 clock_observer_ = tray_date; | 707 clock_observer_ = tray_date; |
684 drive_observer_ = tray_drive; | |
685 ime_observer_ = tray_ime; | 708 ime_observer_ = tray_ime; |
686 network_observer_ = tray_network; | 709 network_observer_ = tray_network; |
687 power_status_observer_ = tray_power; | 710 power_status_observer_ = tray_power; |
688 update_observer_ = tray_update; | 711 update_observer_ = tray_update; |
689 user_observer_ = tray_user; | 712 user_observer_ = tray_user; |
690 | 713 |
691 AddTrayItem(tray_user); | 714 AddTrayItem(tray_user); |
692 AddTrayItem(new internal::TrayEmpty()); | 715 AddTrayItem(new internal::TrayEmpty()); |
693 AddTrayItem(tray_power); | 716 AddTrayItem(tray_power); |
694 AddTrayItem(tray_network); | 717 AddTrayItem(tray_network); |
695 AddTrayItem(tray_bluetooth); | 718 AddTrayItem(tray_bluetooth); |
696 AddTrayItem(tray_drive); | |
697 AddTrayItem(tray_ime); | 719 AddTrayItem(tray_ime); |
698 AddTrayItem(tray_volume); | 720 AddTrayItem(tray_volume); |
699 AddTrayItem(tray_brightness); | 721 AddTrayItem(tray_brightness); |
700 AddTrayItem(tray_update); | 722 AddTrayItem(tray_update); |
701 AddTrayItem(tray_accessibility); | 723 AddTrayItem(tray_accessibility); |
702 AddTrayItem(tray_caps_lock); | 724 AddTrayItem(tray_caps_lock); |
703 AddTrayItem(new internal::TraySettings()); | 725 AddTrayItem(new internal::TraySettings()); |
704 AddTrayItem(tray_date); | 726 AddTrayItem(tray_date); |
705 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> | 727 SetVisible(ash::Shell::GetInstance()->tray_delegate()-> |
706 GetTrayVisibilityOnStartup()); | 728 GetTrayVisibilityOnStartup()); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 canvas->DrawFocusRect(container_->bounds()); | 874 canvas->DrawFocusRect(container_->bounds()); |
853 } | 875 } |
854 | 876 |
855 void SystemTray::UpdateBackground(int alpha) { | 877 void SystemTray::UpdateBackground(int alpha) { |
856 background_->set_alpha(hide_background_animator_.alpha() + | 878 background_->set_alpha(hide_background_animator_.alpha() + |
857 hover_background_animator_.alpha()); | 879 hover_background_animator_.alpha()); |
858 SchedulePaint(); | 880 SchedulePaint(); |
859 } | 881 } |
860 | 882 |
861 } // namespace ash | 883 } // namespace ash |
OLD | NEW |