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

Side by Side Diff: ash/common/system/chromeos/screen_security/screen_tray_item.cc

Issue 2743523003: Remove non-MD code from screen_tray_item.cc (Closed)
Patch Set: Included missing headers Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/system/chromeos/screen_security/screen_tray_item.h" 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/system/tray/system_tray.h"
8 #include "ash/common/shelf/wm_shelf_util.h"
9 #include "ash/common/system/tray/fixed_sized_image_view.h"
10 #include "ash/common/system/tray/tray_constants.h" 8 #include "ash/common/system/tray/tray_constants.h"
11 #include "ash/common/system/tray/tray_popup_item_style.h" 9 #include "ash/common/system/tray/tray_popup_item_style.h"
12 #include "ash/common/system/tray/tray_popup_utils.h" 10 #include "ash/common/system/tray/tray_popup_utils.h"
13 #include "ash/resources/grit/ash_resources.h"
14 #include "ash/resources/vector_icons/vector_icons.h" 11 #include "ash/resources/vector_icons/vector_icons.h"
15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/paint_vector_icon.h" 12 #include "ui/gfx/paint_vector_icon.h"
17 #include "ui/message_center/message_center.h" 13 #include "ui/message_center/message_center.h"
18 #include "ui/views/controls/button/label_button.h" 14 #include "ui/views/controls/button/label_button.h"
15 #include "ui/views/controls/image_view.h"
19 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
20 #include "ui/views/layout/fill_layout.h" 17 #include "ui/views/layout/fill_layout.h"
21 18
22 namespace ash { 19 namespace ash {
23 namespace tray { 20 namespace tray {
24 21
25 // ScreenTrayView implementations. 22 // ScreenTrayView implementations.
26 ScreenTrayView::ScreenTrayView(ScreenTrayItem* screen_tray_item) 23 ScreenTrayView::ScreenTrayView(ScreenTrayItem* screen_tray_item)
27 : TrayItemView(screen_tray_item), screen_tray_item_(screen_tray_item) { 24 : TrayItemView(screen_tray_item), screen_tray_item_(screen_tray_item) {
28 CreateImageView(); 25 CreateImageView();
29 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { 26 image_view()->SetImage(
30 image_view()->SetImage( 27 gfx::CreateVectorIcon(kSystemTrayScreenShareIcon, kTrayIconColor));
31 gfx::CreateVectorIcon(kSystemTrayScreenShareIcon, kTrayIconColor));
32 } else {
33 image_view()->SetImage(ui::ResourceBundle::GetSharedInstance()
34 .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE)
35 .ToImageSkia());
36 }
37 Update(); 28 Update();
38 } 29 }
39 30
40 ScreenTrayView::~ScreenTrayView() {} 31 ScreenTrayView::~ScreenTrayView() {}
41 32
42 void ScreenTrayView::Update() { 33 void ScreenTrayView::Update() {
43 SetVisible(screen_tray_item_->is_started()); 34 SetVisible(screen_tray_item_->is_started());
44 } 35 }
45 36
46 // ScreenStatusView implementations. 37 // ScreenStatusView implementations.
(...skipping 29 matching lines...) Expand all
76 ScreenStatusView::~ScreenStatusView() {} 67 ScreenStatusView::~ScreenStatusView() {}
77 68
78 void ScreenStatusView::ButtonPressed(views::Button* sender, 69 void ScreenStatusView::ButtonPressed(views::Button* sender,
79 const ui::Event& event) { 70 const ui::Event& event) {
80 DCHECK(sender == stop_button_); 71 DCHECK(sender == stop_button_);
81 screen_tray_item_->Stop(); 72 screen_tray_item_->Stop();
82 screen_tray_item_->RecordStoppedFromDefaultViewMetric(); 73 screen_tray_item_->RecordStoppedFromDefaultViewMetric();
83 } 74 }
84 75
85 void ScreenStatusView::CreateItems() { 76 void ScreenStatusView::CreateItems() {
86 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial();
87 icon_ = TrayPopupUtils::CreateMainImageView(); 77 icon_ = TrayPopupUtils::CreateMainImageView();
88 icon_->SetImage(gfx::CreateVectorIcon( 78 icon_->SetImage(gfx::CreateVectorIcon(
89 kSystemMenuScreenShareIcon, TrayPopupItemStyle::GetIconColor( 79 kSystemMenuScreenShareIcon, TrayPopupItemStyle::GetIconColor(
90 TrayPopupItemStyle::ColorStyle::ACTIVE))); 80 TrayPopupItemStyle::ColorStyle::ACTIVE)));
91 if (!use_md) {
92 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
93 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
94 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK)
95 .ToImageSkia());
96 }
97
98 label_ = TrayPopupUtils::CreateDefaultLabel(); 81 label_ = TrayPopupUtils::CreateDefaultLabel();
99 label_->SetMultiLine(true); 82 label_->SetMultiLine(true);
100 label_->SetText(label_text_); 83 label_->SetText(label_text_);
101 // TODO(bruthig): Multiline Labels don't lay out well with borders. 84 // TODO(bruthig): Multiline Labels don't lay out well with borders.
102 // See https://crbug.com/678337 & https://crbug.com/682221. 85 // See https://crbug.com/678337 & https://crbug.com/682221.
103 label_->SetBorder(nullptr); 86 label_->SetBorder(nullptr);
104 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL); 87 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL);
105 style.SetupLabel(label_); 88 style.SetupLabel(label_);
106 89
107 stop_button_ = TrayPopupUtils::CreateTrayPopupButton(this, stop_button_text_); 90 stop_button_ = TrayPopupUtils::CreateTrayPopupButton(this, stop_button_text_);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 169
187 void ScreenTrayItem::DestroyTrayView() { 170 void ScreenTrayItem::DestroyTrayView() {
188 tray_view_ = nullptr; 171 tray_view_ = nullptr;
189 } 172 }
190 173
191 void ScreenTrayItem::DestroyDefaultView() { 174 void ScreenTrayItem::DestroyDefaultView() {
192 default_view_ = nullptr; 175 default_view_ = nullptr;
193 } 176 }
194 177
195 } // namespace ash 178 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698