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

Side by Side Diff: ash/common/system/date/date_view.cc

Issue 2661023006: Remove unused references to NativeTheme in TrayPopupItemStyle. (Closed)
Patch Set: slight improvement Created 3 years, 10 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
« no previous file with comments | « ash/common/system/date/date_view.h ('k') | ash/common/system/tray/hover_highlight_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/system/date/date_view.h" 5 #include "ash/common/system/date/date_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/system_tray_controller.h" 8 #include "ash/common/system/tray/system_tray_controller.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_popup_item_style.h" 10 #include "ash/common/system/tray/tray_popup_item_style.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 SetLayoutManager(box_layout); 176 SetLayoutManager(box_layout);
177 } else { 177 } else {
178 SetLayoutManager( 178 SetLayoutManager(
179 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 179 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
180 } 180 }
181 date_label_ = TrayPopupUtils::CreateDefaultLabel(); 181 date_label_ = TrayPopupUtils::CreateDefaultLabel();
182 date_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 182 date_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
183 if (!UseMd()) 183 if (!UseMd())
184 date_label_->SetEnabledColor(kHeaderTextColorNormal); 184 date_label_->SetEnabledColor(kHeaderTextColorNormal);
185 UpdateTextInternal(base::Time::Now()); 185 UpdateTextInternal(base::Time::Now());
186 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO);
187 style.SetupLabel(date_label_);
186 AddChildView(date_label_); 188 AddChildView(date_label_);
187 } 189 }
188 190
189 DateView::~DateView() {} 191 DateView::~DateView() {}
190 192
191 void DateView::SetAction(DateAction action) { 193 void DateView::SetAction(DateAction action) {
192 if (action == action_) 194 if (action == action_)
193 return; 195 return;
194 if (IsMouseHovered() && !UseMd()) { 196 if (IsMouseHovered() && !UseMd()) {
195 date_label_->SetEnabledColor(action == DateAction::NONE 197 date_label_->SetEnabledColor(action == DateAction::NONE
(...skipping 25 matching lines...) Expand all
221 223
222 void DateView::SetActive(bool active) { 224 void DateView::SetActive(bool active) {
223 if (UseMd()) 225 if (UseMd())
224 return; 226 return;
225 227
226 date_label_->SetEnabledColor(active ? kHeaderTextColorHover 228 date_label_->SetEnabledColor(active ? kHeaderTextColorHover
227 : kHeaderTextColorNormal); 229 : kHeaderTextColorNormal);
228 SchedulePaint(); 230 SchedulePaint();
229 } 231 }
230 232
231 void DateView::UpdateStyle() {
232 TrayPopupItemStyle style(GetNativeTheme(),
233 TrayPopupItemStyle::FontStyle::SYSTEM_INFO);
234 style.SetupLabel(date_label_);
235 }
236
237 void DateView::UpdateTextInternal(const base::Time& now) { 233 void DateView::UpdateTextInternal(const base::Time& now) {
238 BaseDateTimeView::UpdateTextInternal(now); 234 BaseDateTimeView::UpdateTextInternal(now);
239 date_label_->SetText(l10n_util::GetStringFUTF16( 235 date_label_->SetText(l10n_util::GetStringFUTF16(
240 IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now))); 236 IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now)));
241 } 237 }
242 238
243 bool DateView::PerformAction(const ui::Event& event) { 239 bool DateView::PerformAction(const ui::Event& event) {
244 if (action_ == DateAction::NONE) 240 if (action_ == DateAction::NONE)
245 return false; 241 return false;
246 if (action_ == DateAction::SHOW_DATE_SETTINGS) 242 if (action_ == DateAction::SHOW_DATE_SETTINGS)
(...skipping 21 matching lines...) Expand all
268 void DateView::OnGestureEvent(ui::GestureEvent* event) { 264 void DateView::OnGestureEvent(ui::GestureEvent* event) {
269 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 265 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
270 SetActive(true); 266 SetActive(true);
271 } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || 267 } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL ||
272 event->type() == ui::ET_GESTURE_END) { 268 event->type() == ui::ET_GESTURE_END) {
273 SetActive(false); 269 SetActive(false);
274 } 270 }
275 BaseDateTimeView::OnGestureEvent(event); 271 BaseDateTimeView::OnGestureEvent(event);
276 } 272 }
277 273
278 void DateView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
279 UpdateStyle();
280 }
281
282 /////////////////////////////////////////////////////////////////////////////// 274 ///////////////////////////////////////////////////////////////////////////////
283 275
284 TimeView::TimeView(ClockLayout clock_layout) : BaseDateTimeView(nullptr) { 276 TimeView::TimeView(ClockLayout clock_layout) : BaseDateTimeView(nullptr) {
285 SetupLabels(); 277 SetupLabels();
286 UpdateTextInternal(base::Time::Now()); 278 UpdateTextInternal(base::Time::Now());
287 UpdateClockLayout(clock_layout); 279 UpdateClockLayout(clock_layout);
288 } 280 }
289 281
290 TimeView::~TimeView() {} 282 TimeView::~TimeView() {}
291 283
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } 398 }
407 399
408 void TimeView::SetupLabel(views::Label* label) { 400 void TimeView::SetupLabel(views::Label* label) {
409 label->set_owned_by_client(); 401 label->set_owned_by_client();
410 SetupLabelForTray(label); 402 SetupLabelForTray(label);
411 label->SetElideBehavior(gfx::NO_ELIDE); 403 label->SetElideBehavior(gfx::NO_ELIDE);
412 } 404 }
413 405
414 } // namespace tray 406 } // namespace tray
415 } // namespace ash 407 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/date/date_view.h ('k') | ash/common/system/tray/hover_highlight_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698