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

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

Issue 2132773002: Added UMA metrics for screen capture UI in the status area. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into uma_screen_capture 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 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/shelf/wm_shelf_util.h" 7 #include "ash/common/shelf/wm_shelf_util.h"
8 #include "ash/common/system/tray/fixed_sized_image_view.h" 8 #include "ash/common/system/tray/fixed_sized_image_view.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 label_bounds.set_width(stop_button_->x() - kTrayPopupPaddingBetweenItems - 70 label_bounds.set_width(stop_button_->x() - kTrayPopupPaddingBetweenItems -
71 label_->x()); 71 label_->x());
72 label_->SetBoundsRect(label_bounds); 72 label_->SetBoundsRect(label_bounds);
73 } 73 }
74 } 74 }
75 75
76 void ScreenStatusView::ButtonPressed(views::Button* sender, 76 void ScreenStatusView::ButtonPressed(views::Button* sender,
77 const ui::Event& event) { 77 const ui::Event& event) {
78 DCHECK(sender == stop_button_); 78 DCHECK(sender == stop_button_);
79 screen_tray_item_->Stop(); 79 screen_tray_item_->Stop();
80 screen_tray_item_->RecordStoppedFromDefaultViewMetric();
80 } 81 }
81 82
82 void ScreenStatusView::CreateItems() { 83 void ScreenStatusView::CreateItems() {
83 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 84 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
84 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 85 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
85 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 86 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
86 kTrayPopupPaddingHorizontal, 0, 87 kTrayPopupPaddingHorizontal, 0,
87 kTrayPopupPaddingBetweenItems)); 88 kTrayPopupPaddingBetweenItems));
88 icon_ = new FixedSizedImageView(0, kTrayPopupItemHeight); 89 icon_ = new FixedSizedImageView(0, kTrayPopupItemHeight);
89 icon_->SetImage(bundle.GetImageNamed(icon_id_).ToImageSkia()); 90 icon_->SetImage(bundle.GetImageNamed(icon_id_).ToImageSkia());
(...skipping 16 matching lines...) Expand all
106 107
107 ScreenNotificationDelegate::ScreenNotificationDelegate( 108 ScreenNotificationDelegate::ScreenNotificationDelegate(
108 ScreenTrayItem* screen_tray) 109 ScreenTrayItem* screen_tray)
109 : screen_tray_(screen_tray) {} 110 : screen_tray_(screen_tray) {}
110 111
111 ScreenNotificationDelegate::~ScreenNotificationDelegate() {} 112 ScreenNotificationDelegate::~ScreenNotificationDelegate() {}
112 113
113 void ScreenNotificationDelegate::ButtonClick(int button_index) { 114 void ScreenNotificationDelegate::ButtonClick(int button_index) {
114 DCHECK_EQ(0, button_index); 115 DCHECK_EQ(0, button_index);
115 screen_tray_->Stop(); 116 screen_tray_->Stop();
117 screen_tray_->RecordStoppedFromNotificationViewMetric();
116 } 118 }
117 119
118 } // namespace tray 120 } // namespace tray
119 121
120 ScreenTrayItem::ScreenTrayItem(SystemTray* system_tray) 122 ScreenTrayItem::ScreenTrayItem(SystemTray* system_tray)
121 : SystemTrayItem(system_tray), 123 : SystemTrayItem(system_tray),
122 tray_view_(NULL), 124 tray_view_(NULL),
123 default_view_(NULL), 125 default_view_(NULL),
124 is_started_(false), 126 is_started_(false),
125 stop_callback_(base::Bind(&base::DoNothing)) {} 127 stop_callback_(base::Bind(&base::DoNothing)) {}
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Update(); 162 Update();
161 163
162 if (stop_callback_.is_null()) 164 if (stop_callback_.is_null())
163 return; 165 return;
164 166
165 base::Closure callback = stop_callback_; 167 base::Closure callback = stop_callback_;
166 stop_callback_.Reset(); 168 stop_callback_.Reset();
167 callback.Run(); 169 callback.Run();
168 } 170 }
169 171
172 void ScreenTrayItem::RecordStoppedFromDefaultViewMetric() {}
173
174 void ScreenTrayItem::RecordStoppedFromNotificationViewMetric() {}
175
170 void ScreenTrayItem::DestroyTrayView() { 176 void ScreenTrayItem::DestroyTrayView() {
171 tray_view_ = NULL; 177 tray_view_ = NULL;
172 } 178 }
173 179
174 void ScreenTrayItem::DestroyDefaultView() { 180 void ScreenTrayItem::DestroyDefaultView() {
175 default_view_ = NULL; 181 default_view_ = NULL;
176 } 182 }
177 183
178 void ScreenTrayItem::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { 184 void ScreenTrayItem::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
179 if (!tray_view_) 185 if (!tray_view_)
180 return; 186 return;
181 187
182 // Center the item dependent on the orientation of the shelf. 188 // Center the item dependent on the orientation of the shelf.
183 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment) 189 views::BoxLayout::Orientation layout = IsHorizontalAlignment(alignment)
184 ? views::BoxLayout::kHorizontal 190 ? views::BoxLayout::kHorizontal
185 : views::BoxLayout::kVertical; 191 : views::BoxLayout::kVertical;
186 tray_view_->SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0)); 192 tray_view_->SetLayoutManager(new views::BoxLayout(layout, 0, 0, 0));
187 tray_view_->Layout(); 193 tray_view_->Layout();
188 } 194 }
189 195
190 } // namespace ash 196 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/screen_security/screen_tray_item.h ('k') | ash/metrics/user_metrics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698