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

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

Issue 2148943002: mash: Create system tray display and rotation lock items via delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/login_status.h" 8 #include "ash/common/login_status.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 AddTrayItem(new TrayIME(this)); 190 AddTrayItem(new TrayIME(this));
191 AddTrayItem(tray_accessibility_); 191 AddTrayItem(tray_accessibility_);
192 AddTrayItem(new TrayTracing(this)); 192 AddTrayItem(new TrayTracing(this));
193 AddTrayItem(new TrayPower(this, message_center::MessageCenter::Get())); 193 AddTrayItem(new TrayPower(this, message_center::MessageCenter::Get()));
194 AddTrayItem(new TrayNetwork(this)); 194 AddTrayItem(new TrayNetwork(this));
195 AddTrayItem(new TrayVPN(this)); 195 AddTrayItem(new TrayVPN(this));
196 AddTrayItem(new TraySms(this)); 196 AddTrayItem(new TraySms(this));
197 AddTrayItem(new TrayBluetooth(this)); 197 AddTrayItem(new TrayBluetooth(this));
198 tray_cast_ = new TrayCast(this); 198 tray_cast_ = new TrayCast(this);
199 AddTrayItem(tray_cast_); 199 AddTrayItem(tray_cast_);
200 AddTrayItem(new TrayDisplay(this)); 200 std::unique_ptr<SystemTrayItem> tray_display =
msw 2016/07/13 18:51:49 optional nit: add a comment?
James Cook 2016/07/13 21:30:46 Done.
201 delegate->CreateDisplayTrayItem(this);
202 if (tray_display)
203 AddTrayItem(tray_display.release());
201 screen_capture_tray_item_ = new ScreenCaptureTrayItem(this); 204 screen_capture_tray_item_ = new ScreenCaptureTrayItem(this);
202 AddTrayItem(screen_capture_tray_item_); 205 AddTrayItem(screen_capture_tray_item_);
203 screen_share_tray_item_ = new ScreenShareTrayItem(this); 206 screen_share_tray_item_ = new ScreenShareTrayItem(this);
204 AddTrayItem(screen_share_tray_item_); 207 AddTrayItem(screen_share_tray_item_);
205 AddTrayItem(new MultiProfileMediaTrayItem(this)); 208 AddTrayItem(new MultiProfileMediaTrayItem(this));
206 AddTrayItem(new TrayAudioChromeOs(this)); 209 AddTrayItem(new TrayAudioChromeOs(this));
207 AddTrayItem(new TrayBrightness(this)); 210 AddTrayItem(new TrayBrightness(this));
208 AddTrayItem(new TrayCapsLock(this)); 211 AddTrayItem(new TrayCapsLock(this));
209 AddTrayItem(new TrayRotationLock(this)); 212 AddTrayItem(new TrayRotationLock(this));
210 AddTrayItem(new TraySettings(this)); 213 AddTrayItem(new TraySettings(this));
(...skipping 15 matching lines...) Expand all
226 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); 229 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus());
227 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); 230 item->UpdateAfterShelfAlignmentChange(shelf_alignment());
228 231
229 if (tray_item) { 232 if (tray_item) {
230 tray_container()->AddChildViewAt(tray_item, 0); 233 tray_container()->AddChildViewAt(tray_item, 0);
231 PreferredSizeChanged(); 234 PreferredSizeChanged();
232 tray_item_map_[item] = tray_item; 235 tray_item_map_[item] = tray_item;
233 } 236 }
234 } 237 }
235 238
236 void SystemTray::RemoveTrayItem(SystemTrayItem* item) {
237 NOTIMPLEMENTED();
238 }
239
240 const std::vector<SystemTrayItem*>& SystemTray::GetTrayItems() const { 239 const std::vector<SystemTrayItem*>& SystemTray::GetTrayItems() const {
241 return items_.get(); 240 return items_.get();
242 } 241 }
243 242
244 void SystemTray::ShowDefaultView(BubbleCreationType creation_type) { 243 void SystemTray::ShowDefaultView(BubbleCreationType creation_type) {
245 ShowDefaultViewWithOffset( 244 ShowDefaultViewWithOffset(
246 creation_type, TrayBubbleView::InitParams::kArrowDefaultOffset, false); 245 creation_type, TrayBubbleView::InitParams::kArrowDefaultOffset, false);
247 } 246 }
248 247
249 void SystemTray::ShowPersistentDefaultView() { 248 void SystemTray::ShowPersistentDefaultView() {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 .work_area() 762 .work_area()
764 .height(); 763 .height();
765 if (work_area_height > 0) { 764 if (work_area_height > 0) {
766 UMA_HISTOGRAM_CUSTOM_COUNTS( 765 UMA_HISTOGRAM_CUSTOM_COUNTS(
767 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", 766 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu",
768 100 * bubble_view->height() / work_area_height, 1, 300, 100); 767 100 * bubble_view->height() / work_area_height, 1, 300, 100);
769 } 768 }
770 } 769 }
771 770
772 } // namespace ash 771 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698