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

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

Issue 2591553002: Remove non-cros support from ash/common/system. (Closed)
Patch Set: Created 4 years 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/common/system/date/tray_date.h" 5 #include "ash/common/system/date/tray_date.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/chromeos/system_clock_observer.h"
8 #include "ash/common/system/date/date_default_view.h" 9 #include "ash/common/system/date/date_default_view.h"
9 #include "ash/common/system/date/date_view.h" 10 #include "ash/common/system/date/date_view.h"
10 #include "ash/common/system/tray/system_tray.h" 11 #include "ash/common/system/tray/system_tray.h"
11 #include "ash/common/system/tray/system_tray_notifier.h" 12 #include "ash/common/system/tray/system_tray_notifier.h"
12 #include "ash/common/system/tray/tray_item_view.h" 13 #include "ash/common/system/tray/tray_item_view.h"
13 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
14 15
15 #if defined(OS_CHROMEOS)
16 #include "ash/common/system/chromeos/system_clock_observer.h"
17 #endif
18
19 namespace ash { 16 namespace ash {
20 17
21 TrayDate::TrayDate(SystemTray* system_tray) 18 TrayDate::TrayDate(SystemTray* system_tray)
22 : SystemTrayItem(system_tray, UMA_DATE), 19 : SystemTrayItem(system_tray, UMA_DATE),
23 time_tray_(NULL), 20 time_tray_(NULL),
24 default_view_(NULL), 21 default_view_(NULL),
25 login_status_(LoginStatus::NOT_LOGGED_IN) { 22 login_status_(LoginStatus::NOT_LOGGED_IN) {
26 #if defined(OS_CHROMEOS)
27 system_clock_observer_.reset(new SystemClockObserver()); 23 system_clock_observer_.reset(new SystemClockObserver());
James Cook 2016/12/20 00:02:24 nit: move into constructor initializer list
Evan Stade 2016/12/20 18:25:21 Done.
28 #endif
29 WmShell::Get()->system_tray_notifier()->AddClockObserver(this); 24 WmShell::Get()->system_tray_notifier()->AddClockObserver(this);
30 } 25 }
31 26
32 TrayDate::~TrayDate() { 27 TrayDate::~TrayDate() {
33 WmShell::Get()->system_tray_notifier()->RemoveClockObserver(this); 28 WmShell::Get()->system_tray_notifier()->RemoveClockObserver(this);
34 } 29 }
35 30
36 views::View* TrayDate::GetHelpButtonView() const { 31 views::View* TrayDate::GetHelpButtonView() const {
37 if (!default_view_) 32 if (!default_view_)
38 return NULL; 33 return NULL;
(...skipping 20 matching lines...) Expand all
59 : tray::TimeView::ClockLayout::VERTICAL_CLOCK; 54 : tray::TimeView::ClockLayout::VERTICAL_CLOCK;
60 time_tray_ = new tray::TimeView(clock_layout); 55 time_tray_ = new tray::TimeView(clock_layout);
61 views::View* view = new TrayItemView(this); 56 views::View* view = new TrayItemView(this);
62 view->AddChildView(time_tray_); 57 view->AddChildView(time_tray_);
63 return view; 58 return view;
64 } 59 }
65 60
66 views::View* TrayDate::CreateDefaultView(LoginStatus status) { 61 views::View* TrayDate::CreateDefaultView(LoginStatus status) {
67 default_view_ = new DateDefaultView(this, status); 62 default_view_ = new DateDefaultView(this, status);
68 63
69 #if defined(OS_CHROMEOS)
70 // Save the login status we created the view with. 64 // Save the login status we created the view with.
71 login_status_ = status; 65 login_status_ = status;
72 66
73 OnSystemClockCanSetTimeChanged(system_clock_observer_->can_set_time()); 67 OnSystemClockCanSetTimeChanged(system_clock_observer_->can_set_time());
74 #endif
75 return default_view_; 68 return default_view_;
76 } 69 }
77 70
78 views::View* TrayDate::CreateDetailedView(LoginStatus status) { 71 views::View* TrayDate::CreateDetailedView(LoginStatus status) {
79 return NULL; 72 return NULL;
80 } 73 }
81 74
82 void TrayDate::DestroyTrayView() { 75 void TrayDate::DestroyTrayView() {
83 time_tray_ = NULL; 76 time_tray_ = NULL;
84 } 77 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 : tray::DateView::DateAction::NONE); 117 : tray::DateView::DateAction::NONE);
125 } 118 }
126 } 119 }
127 120
128 void TrayDate::Refresh() { 121 void TrayDate::Refresh() {
129 if (time_tray_) 122 if (time_tray_)
130 time_tray_->UpdateText(); 123 time_tray_->UpdateText();
131 } 124 }
132 125
133 } // namespace ash 126 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698