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/shell.h" | 10 #include "ash/shell.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 AddTrayItem(new TrayEnterprise(this)); | 175 AddTrayItem(new TrayEnterprise(this)); |
176 AddTrayItem(new TraySupervisedUser(this)); | 176 AddTrayItem(new TraySupervisedUser(this)); |
177 AddTrayItem(new TrayIME(this)); | 177 AddTrayItem(new TrayIME(this)); |
178 AddTrayItem(tray_accessibility_); | 178 AddTrayItem(tray_accessibility_); |
179 AddTrayItem(new TrayTracing(this)); | 179 AddTrayItem(new TrayTracing(this)); |
180 AddTrayItem(new TrayPower(this, message_center::MessageCenter::Get())); | 180 AddTrayItem(new TrayPower(this, message_center::MessageCenter::Get())); |
181 AddTrayItem(new TrayNetwork(this)); | 181 AddTrayItem(new TrayNetwork(this)); |
182 AddTrayItem(new TrayVPN(this)); | 182 AddTrayItem(new TrayVPN(this)); |
183 AddTrayItem(new TraySms(this)); | 183 AddTrayItem(new TraySms(this)); |
184 AddTrayItem(new TrayBluetooth(this)); | 184 AddTrayItem(new TrayBluetooth(this)); |
185 AddTrayItem(new TrayCast(this)); | 185 tray_cast_ = new TrayCast(this); |
186 AddTrayItem(tray_cast_); | |
186 AddTrayItem(new TrayDisplay(this)); | 187 AddTrayItem(new TrayDisplay(this)); |
187 screen_capture_tray_item_ = new ScreenCaptureTrayItem(this); | 188 screen_capture_tray_item_ = new ScreenCaptureTrayItem(this); |
188 AddTrayItem(screen_capture_tray_item_); | 189 AddTrayItem(screen_capture_tray_item_); |
189 screen_share_tray_item_ = new ScreenShareTrayItem(this); | 190 screen_share_tray_item_ = new ScreenShareTrayItem(this); |
190 AddTrayItem(screen_share_tray_item_); | 191 AddTrayItem(screen_share_tray_item_); |
191 AddTrayItem(new MultiProfileMediaTrayItem(this)); | 192 AddTrayItem(new MultiProfileMediaTrayItem(this)); |
192 AddTrayItem(new TrayAudioChromeOs(this)); | 193 AddTrayItem(new TrayAudioChromeOs(this)); |
193 AddTrayItem(new TrayBrightness(this)); | 194 AddTrayItem(new TrayBrightness(this)); |
194 AddTrayItem(new TrayCapsLock(this)); | 195 AddTrayItem(new TrayCapsLock(this)); |
195 AddTrayItem(new TrayRotationLock(this)); | 196 AddTrayItem(new TrayRotationLock(this)); |
196 AddTrayItem(new TraySettings(this)); | 197 AddTrayItem(new TraySettings(this)); |
197 AddTrayItem(new TrayUpdate(this)); | 198 AddTrayItem(new TrayUpdate(this)); |
198 AddTrayItem(tray_date_); | 199 AddTrayItem(tray_date_); |
199 #elif defined(OS_WIN) | 200 #elif defined(OS_WIN) |
200 AddTrayItem(tray_accessibility_); | 201 AddTrayItem(tray_accessibility_); |
201 if (media::CoreAudioUtil::IsSupported()) | 202 if (media::CoreAudioUtil::IsSupported()) |
202 AddTrayItem(new TrayAudioWin(this)); | 203 AddTrayItem(new TrayAudioWin(this)); |
203 AddTrayItem(new TrayUpdate(this)); | 204 AddTrayItem(new TrayUpdate(this)); |
204 AddTrayItem(tray_date_); | 205 AddTrayItem(tray_date_); |
205 #elif defined(OS_LINUX) | 206 #elif defined(OS_LINUX) |
206 AddTrayItem(tray_accessibility_); | 207 AddTrayItem(tray_accessibility_); |
207 AddTrayItem(new TrayBluetooth(this)); | 208 AddTrayItem(new TrayBluetooth(this)); |
208 AddTrayItem(new TrayCast(this)); | 209 tray_cast_ = new TrayCast(this); |
210 AddTrayItem(tray_cast_); | |
achuithb
2015/07/14 18:06:39
Tell me again why we have this on linux?
jdufault
2015/07/15 17:35:01
I don't know - this was in the initial code you ha
achuithb
2015/07/15 18:56:47
Let get rid of it and see if anything breaks. I be
jdufault
2015/07/15 20:08:42
Done.
| |
209 AddTrayItem(new TrayUpdate(this)); | 211 AddTrayItem(new TrayUpdate(this)); |
210 AddTrayItem(tray_date_); | 212 AddTrayItem(tray_date_); |
211 #endif | 213 #endif |
212 | 214 |
213 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> | 215 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> |
214 GetTrayVisibilityOnStartup()); | 216 GetTrayVisibilityOnStartup()); |
215 } | 217 } |
216 | 218 |
217 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 219 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
218 items_.push_back(item); | 220 items_.push_back(item); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { | 689 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { |
688 HideBubbleWithView(bubble_view); | 690 HideBubbleWithView(bubble_view); |
689 } | 691 } |
690 | 692 |
691 views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) { | 693 views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) { |
692 std::map<SystemTrayItem*, views::View*>::iterator it = | 694 std::map<SystemTrayItem*, views::View*>::iterator it = |
693 tray_item_map_.find(item); | 695 tray_item_map_.find(item); |
694 return it == tray_item_map_.end() ? NULL : it->second; | 696 return it == tray_item_map_.end() ? NULL : it->second; |
695 } | 697 } |
696 | 698 |
699 TrayCast* SystemTray::GetTrayCastForTesting() const { return tray_cast_; } | |
700 | |
697 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } | 701 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } |
698 | 702 |
699 bool SystemTray::PerformAction(const ui::Event& event) { | 703 bool SystemTray::PerformAction(const ui::Event& event) { |
700 // If we're already showing the default view, hide it; otherwise, show it | 704 // If we're already showing the default view, hide it; otherwise, show it |
701 // (and hide any popup that's currently shown). | 705 // (and hide any popup that's currently shown). |
702 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { | 706 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { |
703 system_bubble_->bubble()->Close(); | 707 system_bubble_->bubble()->Close(); |
704 } else { | 708 } else { |
705 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; | 709 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; |
706 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { | 710 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { |
(...skipping 15 matching lines...) Expand all Loading... | |
722 system_bubble_.reset(); | 726 system_bubble_.reset(); |
723 // When closing a system bubble with the alternate shelf layout, we need to | 727 // When closing a system bubble with the alternate shelf layout, we need to |
724 // turn off the active tinting of the shelf. | 728 // turn off the active tinting of the shelf. |
725 if (full_system_tray_menu_) { | 729 if (full_system_tray_menu_) { |
726 SetDrawBackgroundAsActive(false); | 730 SetDrawBackgroundAsActive(false); |
727 full_system_tray_menu_ = false; | 731 full_system_tray_menu_ = false; |
728 } | 732 } |
729 } | 733 } |
730 | 734 |
731 } // namespace ash | 735 } // namespace ash |
OLD | NEW |