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

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

Issue 2041233005: Moves ash::user::LoginStatus to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 6 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/date_default_view.h ('k') | ash/system/date/tray_date.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/date_default_view.h" 5 #include "ash/system/date/date_default_view.h"
6 6
7 #include "ash/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/metrics/user_metrics_recorder.h" 8 #include "ash/metrics/user_metrics_recorder.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/date/date_view.h" 10 #include "ash/system/date/date_view.h"
(...skipping 16 matching lines...) Expand all
27 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is 27 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is
28 // not mirrored in this locale. 28 // not mirrored in this locale.
29 const char kHebrewLocale[] = "he"; 29 const char kHebrewLocale[] = "he";
30 30
31 const int kPaddingVertical = 19; 31 const int kPaddingVertical = 19;
32 32
33 } // namespace 33 } // namespace
34 34
35 namespace ash { 35 namespace ash {
36 36
37 DateDefaultView::DateDefaultView(ash::user::LoginStatus login) 37 DateDefaultView::DateDefaultView(LoginStatus login)
38 : help_button_(NULL), 38 : help_button_(NULL),
39 shutdown_button_(NULL), 39 shutdown_button_(NULL),
40 lock_button_(NULL), 40 lock_button_(NULL),
41 date_view_(NULL), 41 date_view_(NULL),
42 weak_factory_(this) { 42 weak_factory_(this) {
43 SetLayoutManager(new views::FillLayout); 43 SetLayoutManager(new views::FillLayout);
44 44
45 date_view_ = new tray::DateView(); 45 date_view_ = new tray::DateView();
46 date_view_->SetBorder(views::Border::CreateEmptyBorder( 46 date_view_->SetBorder(views::Border::CreateEmptyBorder(
47 kPaddingVertical, ash::kTrayPopupPaddingHorizontal, 0, 0)); 47 kPaddingVertical, ash::kTrayPopupPaddingHorizontal, 0, 0));
48 SpecialPopupRow* view = new SpecialPopupRow(); 48 SpecialPopupRow* view = new SpecialPopupRow();
49 view->SetContent(date_view_); 49 view->SetContent(date_view_);
50 AddChildView(view); 50 AddChildView(view);
51 51
52 bool userAddingRunning = ash::Shell::GetInstance() 52 bool userAddingRunning = ash::Shell::GetInstance()
53 ->session_state_delegate() 53 ->session_state_delegate()
54 ->IsInSecondaryLoginScreen(); 54 ->IsInSecondaryLoginScreen();
55 55
56 if (login == user::LOGGED_IN_LOCKED || 56 if (login == LoginStatus::LOCKED || login == LoginStatus::NOT_LOGGED_IN ||
57 login == user::LOGGED_IN_NONE || userAddingRunning) 57 userAddingRunning)
58 return; 58 return;
59 59
60 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); 60 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS);
61 61
62 help_button_ = new TrayPopupHeaderButton( 62 help_button_ = new TrayPopupHeaderButton(
63 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, 63 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP,
64 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, 64 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER,
65 IDS_ASH_STATUS_TRAY_HELP); 65 IDS_ASH_STATUS_TRAY_HELP);
66 if (base::i18n::IsRTL() && 66 if (base::i18n::IsRTL() &&
67 base::i18n::GetConfiguredLocale() == kHebrewLocale) { 67 base::i18n::GetConfiguredLocale() == kHebrewLocale) {
68 // The asset for the help button is a question mark '?'. Normally this asset 68 // The asset for the help button is a question mark '?'. Normally this asset
69 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the 69 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the
70 // flipping must be disabled. (crbug.com/475237) 70 // flipping must be disabled. (crbug.com/475237)
71 help_button_->EnableCanvasFlippingForRTLUI(false); 71 help_button_->EnableCanvasFlippingForRTLUI(false);
72 } 72 }
73 help_button_->SetTooltipText( 73 help_button_->SetTooltipText(
74 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); 74 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP));
75 view->AddButton(help_button_); 75 view->AddButton(help_button_);
76 76
77 #if !defined(OS_WIN) 77 #if !defined(OS_WIN)
78 if (login != ash::user::LOGGED_IN_LOCKED) { 78 if (login != LoginStatus::LOCKED) {
79 shutdown_button_ = new TrayPopupHeaderButton( 79 shutdown_button_ = new TrayPopupHeaderButton(
80 this, IDR_AURA_UBER_TRAY_SHUTDOWN, IDR_AURA_UBER_TRAY_SHUTDOWN, 80 this, IDR_AURA_UBER_TRAY_SHUTDOWN, IDR_AURA_UBER_TRAY_SHUTDOWN,
81 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, 81 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER,
82 IDS_ASH_STATUS_TRAY_SHUTDOWN); 82 IDS_ASH_STATUS_TRAY_SHUTDOWN);
83 shutdown_button_->SetTooltipText( 83 shutdown_button_->SetTooltipText(
84 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SHUTDOWN)); 84 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SHUTDOWN));
85 view->AddButton(shutdown_button_); 85 view->AddButton(shutdown_button_);
86 } 86 }
87 87
88 if (ash::Shell::GetInstance()->session_state_delegate()->CanLockScreen()) { 88 if (ash::Shell::GetInstance()->session_state_delegate()->CanLockScreen()) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { 147 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) {
148 if (!shutdown_button_) 148 if (!shutdown_button_)
149 return; 149 return;
150 150
151 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( 151 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16(
152 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT 152 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT
153 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); 153 : IDS_ASH_STATUS_TRAY_SHUTDOWN));
154 } 154 }
155 155
156 } // namespace ash 156 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/date/date_default_view.h ('k') | ash/system/date/tray_date.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698