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

Side by Side Diff: ash/system/date/tray_system_info.cc

Issue 2807693002: Make LogoutButtonTray a regular View (Closed)
Patch Set: Rebased Created 3 years, 8 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/system/date/tray_system_info.h ('k') | ash/system/ime_menu/ime_menu_tray.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/date/tray_system_info.h" 5 #include "ash/system/date/tray_system_info.h"
6 6
7 #include "ash/shelf/wm_shelf_util.h" 7 #include "ash/shelf/wm_shelf.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/date/date_view.h" 9 #include "ash/system/date/date_view.h"
10 #include "ash/system/date/system_info_default_view.h" 10 #include "ash/system/date/system_info_default_view.h"
11 #include "ash/system/system_clock_observer.h" 11 #include "ash/system/system_clock_observer.h"
12 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/system_tray.h"
13 #include "ash/system/tray/system_tray_notifier.h" 13 #include "ash/system/tray/system_tray_notifier.h"
14 #include "ash/system/tray/tray_item_view.h" 14 #include "ash/system/tray/tray_item_view.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
(...skipping 18 matching lines...) Expand all
36 return default_view_; 36 return default_view_;
37 } 37 }
38 38
39 views::View* TraySystemInfo::CreateDefaultViewForTesting(LoginStatus status) { 39 views::View* TraySystemInfo::CreateDefaultViewForTesting(LoginStatus status) {
40 return CreateDefaultView(status); 40 return CreateDefaultView(status);
41 } 41 }
42 42
43 views::View* TraySystemInfo::CreateTrayView(LoginStatus status) { 43 views::View* TraySystemInfo::CreateTrayView(LoginStatus status) {
44 CHECK(tray_view_ == nullptr); 44 CHECK(tray_view_ == nullptr);
45 tray::TimeView::ClockLayout clock_layout = 45 tray::TimeView::ClockLayout clock_layout =
46 IsHorizontalAlignment(system_tray()->shelf_alignment()) 46 system_tray()->shelf()->IsHorizontalAlignment()
47 ? tray::TimeView::ClockLayout::HORIZONTAL_CLOCK 47 ? tray::TimeView::ClockLayout::HORIZONTAL_CLOCK
48 : tray::TimeView::ClockLayout::VERTICAL_CLOCK; 48 : tray::TimeView::ClockLayout::VERTICAL_CLOCK;
49 tray_view_ = new tray::TimeView(clock_layout); 49 tray_view_ = new tray::TimeView(clock_layout);
50 views::View* view = new TrayItemView(this); 50 views::View* view = new TrayItemView(this);
51 view->AddChildView(tray_view_); 51 view->AddChildView(tray_view_);
52 return view; 52 return view;
53 } 53 }
54 54
55 views::View* TraySystemInfo::CreateDefaultView(LoginStatus status) { 55 views::View* TraySystemInfo::CreateDefaultView(LoginStatus status) {
56 default_view_ = new SystemInfoDefaultView(this); 56 default_view_ = new SystemInfoDefaultView(this);
57 57
58 // Save the login status we created the view with. 58 // Save the login status we created the view with.
59 login_status_ = status; 59 login_status_ = status;
60 60
61 OnSystemClockCanSetTimeChanged(system_clock_observer_->can_set_time()); 61 OnSystemClockCanSetTimeChanged(system_clock_observer_->can_set_time());
62 return default_view_; 62 return default_view_;
63 } 63 }
64 64
65 void TraySystemInfo::DestroyTrayView() { 65 void TraySystemInfo::DestroyTrayView() {
66 tray_view_ = nullptr; 66 tray_view_ = nullptr;
67 } 67 }
68 68
69 void TraySystemInfo::DestroyDefaultView() { 69 void TraySystemInfo::DestroyDefaultView() {
70 default_view_ = nullptr; 70 default_view_ = nullptr;
71 } 71 }
72 72
73 void TraySystemInfo::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { 73 void TraySystemInfo::UpdateAfterShelfAlignmentChange() {
74 if (tray_view_) { 74 if (tray_view_) {
75 tray::TimeView::ClockLayout clock_layout = 75 tray::TimeView::ClockLayout clock_layout =
76 IsHorizontalAlignment(alignment) 76 system_tray()->shelf()->IsHorizontalAlignment()
77 ? tray::TimeView::ClockLayout::HORIZONTAL_CLOCK 77 ? tray::TimeView::ClockLayout::HORIZONTAL_CLOCK
78 : tray::TimeView::ClockLayout::VERTICAL_CLOCK; 78 : tray::TimeView::ClockLayout::VERTICAL_CLOCK;
79 tray_view_->UpdateClockLayout(clock_layout); 79 tray_view_->UpdateClockLayout(clock_layout);
80 } 80 }
81 } 81 }
82 82
83 void TraySystemInfo::OnDateFormatChanged() { 83 void TraySystemInfo::OnDateFormatChanged() {
84 UpdateTimeFormat(); 84 UpdateTimeFormat();
85 } 85 }
86 86
(...skipping 17 matching lines...) Expand all
104 } 104 }
105 105
106 void TraySystemInfo::UpdateTimeFormat() { 106 void TraySystemInfo::UpdateTimeFormat() {
107 if (tray_view_) 107 if (tray_view_)
108 tray_view_->UpdateTimeFormat(); 108 tray_view_->UpdateTimeFormat();
109 if (default_view_) 109 if (default_view_)
110 default_view_->GetDateView()->UpdateTimeFormat(); 110 default_view_->GetDateView()->UpdateTimeFormat();
111 } 111 }
112 112
113 } // namespace ash 113 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/date/tray_system_info.h ('k') | ash/system/ime_menu/ime_menu_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698