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