Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: ash/system/tray/system_tray.cc

Issue 1218653006: Add support code to test the cast system tray item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 AddTrayItem(new TrayUpdate(this)); 209 AddTrayItem(new TrayUpdate(this));
210 AddTrayItem(tray_date_); 210 AddTrayItem(tray_date_);
211 #endif 211 #endif
212 212
213 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> 213 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()->
214 GetTrayVisibilityOnStartup()); 214 GetTrayVisibilityOnStartup());
215 } 215 }
216 216
217 void SystemTray::AddTrayItem(SystemTrayItem* item) { 217 void SystemTray::AddTrayItem(SystemTrayItem* item) {
218 items_.push_back(item); 218 items_.push_back(item);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { 687 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) {
688 HideBubbleWithView(bubble_view); 688 HideBubbleWithView(bubble_view);
689 } 689 }
690 690
691 views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) { 691 views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) {
692 std::map<SystemTrayItem*, views::View*>::iterator it = 692 std::map<SystemTrayItem*, views::View*>::iterator it =
693 tray_item_map_.find(item); 693 tray_item_map_.find(item);
694 return it == tray_item_map_.end() ? NULL : it->second; 694 return it == tray_item_map_.end() ? NULL : it->second;
695 } 695 }
696 696
697 TrayCast* SystemTray::GetTrayCastForTesting() const { return tray_cast_; }
698
697 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } 699 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; }
698 700
699 bool SystemTray::PerformAction(const ui::Event& event) { 701 bool SystemTray::PerformAction(const ui::Event& event) {
700 // If we're already showing the default view, hide it; otherwise, show it 702 // If we're already showing the default view, hide it; otherwise, show it
701 // (and hide any popup that's currently shown). 703 // (and hide any popup that's currently shown).
702 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { 704 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) {
703 system_bubble_->bubble()->Close(); 705 system_bubble_->bubble()->Close();
704 } else { 706 } else {
705 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; 707 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset;
706 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { 708 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) {
(...skipping 15 matching lines...) Expand all
722 system_bubble_.reset(); 724 system_bubble_.reset();
723 // When closing a system bubble with the alternate shelf layout, we need to 725 // When closing a system bubble with the alternate shelf layout, we need to
724 // turn off the active tinting of the shelf. 726 // turn off the active tinting of the shelf.
725 if (full_system_tray_menu_) { 727 if (full_system_tray_menu_) {
726 SetDrawBackgroundAsActive(false); 728 SetDrawBackgroundAsActive(false);
727 full_system_tray_menu_ = false; 729 full_system_tray_menu_ = false;
728 } 730 }
729 } 731 }
730 732
731 } // namespace ash 733 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698