| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/metrics/user_metrics_recorder.h" | 8 #include "ash/metrics/user_metrics_recorder.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 std::map<SystemTrayItem*, views::View*>::iterator it = | 696 std::map<SystemTrayItem*, views::View*>::iterator it = |
| 697 tray_item_map_.find(item); | 697 tray_item_map_.find(item); |
| 698 return it == tray_item_map_.end() ? NULL : it->second; | 698 return it == tray_item_map_.end() ? NULL : it->second; |
| 699 } | 699 } |
| 700 | 700 |
| 701 TrayCast* SystemTray::GetTrayCastForTesting() const { return tray_cast_; } | 701 TrayCast* SystemTray::GetTrayCastForTesting() const { return tray_cast_; } |
| 702 | 702 |
| 703 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } | 703 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } |
| 704 | 704 |
| 705 bool SystemTray::PerformAction(const ui::Event& event) { | 705 bool SystemTray::PerformAction(const ui::Event& event) { |
| 706 //JAMES - this isn't called on mash when you click on the system tray bubble |
| 707 LOG(ERROR) << "JAMES PerformAction"; |
| 706 // If we're already showing the default view, hide it; otherwise, show it | 708 // If we're already showing the default view, hide it; otherwise, show it |
| 707 // (and hide any popup that's currently shown). | 709 // (and hide any popup that's currently shown). |
| 708 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { | 710 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { |
| 711 LOG(ERROR) << "JAMES close"; |
| 709 system_bubble_->bubble()->Close(); | 712 system_bubble_->bubble()->Close(); |
| 710 } else { | 713 } else { |
| 711 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; | 714 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; |
| 712 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { | 715 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { |
| 713 const ui::LocatedEvent& located_event = | 716 const ui::LocatedEvent& located_event = |
| 714 static_cast<const ui::LocatedEvent&>(event); | 717 static_cast<const ui::LocatedEvent&>(event); |
| 718 LOG(ERROR) << "JAMES location " << located_event.location().ToString(); |
| 715 if (wm::IsHorizontalAlignment(shelf_alignment())) { | 719 if (wm::IsHorizontalAlignment(shelf_alignment())) { |
| 716 gfx::Point point(located_event.x(), 0); | 720 gfx::Point point(located_event.x(), 0); |
| 717 ConvertPointToWidget(this, &point); | 721 ConvertPointToWidget(this, &point); |
| 718 arrow_offset = point.x(); | 722 arrow_offset = point.x(); |
| 719 } | 723 } |
| 720 } | 724 } |
| 721 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset, false); | 725 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset, false); |
| 722 } | 726 } |
| 723 return true; | 727 return true; |
| 724 } | 728 } |
| 725 | 729 |
| 726 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { | 730 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { |
| 727 system_bubble_.reset(); | 731 system_bubble_.reset(); |
| 728 // When closing a system bubble with the alternate shelf layout, we need to | 732 // When closing a system bubble with the alternate shelf layout, we need to |
| 729 // turn off the active tinting of the shelf. | 733 // turn off the active tinting of the shelf. |
| 730 if (full_system_tray_menu_) { | 734 if (full_system_tray_menu_) { |
| 731 SetDrawBackgroundAsActive(false); | 735 SetDrawBackgroundAsActive(false); |
| 732 full_system_tray_menu_ = false; | 736 full_system_tray_menu_ = false; |
| 733 } | 737 } |
| 734 } | 738 } |
| 735 | 739 |
| 736 } // namespace ash | 740 } // namespace ash |
| OLD | NEW |