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

Side by Side Diff: ash/system/chromeos/settings/tray_settings.cc

Issue 357323002: Tray elements behave appropriately on the multiple signin screen (more like lock screen) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix Created 6 years, 4 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 (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/system/chromeos/settings/tray_settings.h" 5 #include "ash/system/chromeos/settings/tray_settings.h"
6 6
7 #include "ash/session/session_state_delegate.h"
7 #include "ash/shell.h" 8 #include "ash/shell.h"
8 #include "ash/system/chromeos/power/power_status.h" 9 #include "ash/system/chromeos/power/power_status.h"
9 #include "ash/system/chromeos/power/power_status_view.h" 10 #include "ash/system/chromeos/power/power_status_view.h"
10 #include "ash/system/tray/actionable_view.h" 11 #include "ash/system/tray/actionable_view.h"
11 #include "ash/system/tray/fixed_sized_image_view.h" 12 #include "ash/system/tray/fixed_sized_image_view.h"
12 #include "ash/system/tray/system_tray_delegate.h" 13 #include "ash/system/tray/system_tray_delegate.h"
13 #include "ash/system/tray/tray_constants.h" 14 #include "ash/system/tray/tray_constants.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "grit/ash_resources.h" 17 #include "grit/ash_resources.h"
(...skipping 17 matching lines...) Expand all
34 : login_status_(status), 35 : login_status_(status),
35 label_(NULL), 36 label_(NULL),
36 power_status_view_(NULL) { 37 power_status_view_(NULL) {
37 PowerStatus::Get()->AddObserver(this); 38 PowerStatus::Get()->AddObserver(this);
38 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 39 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
39 ash::kTrayPopupPaddingHorizontal, 0, 40 ash::kTrayPopupPaddingHorizontal, 0,
40 ash::kTrayPopupPaddingBetweenItems)); 41 ash::kTrayPopupPaddingBetweenItems));
41 42
42 bool power_view_right_align = false; 43 bool power_view_right_align = false;
43 if (login_status_ != user::LOGGED_IN_NONE && 44 if (login_status_ != user::LOGGED_IN_NONE &&
44 login_status_ != user::LOGGED_IN_LOCKED) { 45 login_status_ != user::LOGGED_IN_LOCKED &&
46 ash::Shell::GetInstance()
47 ->session_state_delegate()
48 ->GetSessionState() !=
49 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY) {
45 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 50 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
46 views::ImageView* icon = 51 views::ImageView* icon =
47 new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight); 52 new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
48 icon->SetImage( 53 icon->SetImage(
49 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); 54 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia());
50 icon->set_id(test::kSettingsTrayItemViewId); 55 icon->set_id(test::kSettingsTrayItemViewId);
51 AddChildView(icon); 56 AddChildView(icon);
52 57
53 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); 58 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS);
54 label_ = new views::Label(text); 59 label_ = new views::Label(text);
(...skipping 11 matching lines...) Expand all
66 } 71 }
67 } 72 }
68 73
69 virtual ~SettingsDefaultView() { 74 virtual ~SettingsDefaultView() {
70 PowerStatus::Get()->RemoveObserver(this); 75 PowerStatus::Get()->RemoveObserver(this);
71 } 76 }
72 77
73 // Overridden from ash::ActionableView. 78 // Overridden from ash::ActionableView.
74 virtual bool PerformAction(const ui::Event& event) OVERRIDE { 79 virtual bool PerformAction(const ui::Event& event) OVERRIDE {
75 if (login_status_ == user::LOGGED_IN_NONE || 80 if (login_status_ == user::LOGGED_IN_NONE ||
76 login_status_ == user::LOGGED_IN_LOCKED) 81 login_status_ == user::LOGGED_IN_LOCKED ||
82 ash::Shell::GetInstance()
83 ->session_state_delegate()
84 ->GetSessionState() ==
85 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY)
77 return false; 86 return false;
78 87
79 ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings(); 88 ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings();
80 return true; 89 return true;
81 } 90 }
82 91
83 // Overridden from views::View. 92 // Overridden from views::View.
84 virtual void Layout() OVERRIDE { 93 virtual void Layout() OVERRIDE {
85 views::View::Layout(); 94 views::View::Layout();
86 95
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 138 }
130 139
131 TraySettings::~TraySettings() { 140 TraySettings::~TraySettings() {
132 } 141 }
133 142
134 views::View* TraySettings::CreateTrayView(user::LoginStatus status) { 143 views::View* TraySettings::CreateTrayView(user::LoginStatus status) {
135 return NULL; 144 return NULL;
136 } 145 }
137 146
138 views::View* TraySettings::CreateDefaultView(user::LoginStatus status) { 147 views::View* TraySettings::CreateDefaultView(user::LoginStatus status) {
139 if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED) && 148 if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED ||
149 ash::Shell::GetInstance()->session_state_delegate()->GetSessionState() ==
150 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY) &&
140 !PowerStatus::Get()->IsBatteryPresent()) 151 !PowerStatus::Get()->IsBatteryPresent())
141 return NULL; 152 return NULL;
142 if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings()) 153 if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings())
143 return NULL; 154 return NULL;
144 CHECK(default_view_ == NULL); 155 CHECK(default_view_ == NULL);
145 default_view_ = new tray::SettingsDefaultView(status); 156 default_view_ = new tray::SettingsDefaultView(status);
146 return default_view_; 157 return default_view_;
147 } 158 }
148 159
149 views::View* TraySettings::CreateDetailedView(user::LoginStatus status) { 160 views::View* TraySettings::CreateDetailedView(user::LoginStatus status) {
150 NOTIMPLEMENTED(); 161 NOTIMPLEMENTED();
151 return NULL; 162 return NULL;
152 } 163 }
153 164
154 void TraySettings::DestroyTrayView() { 165 void TraySettings::DestroyTrayView() {
155 } 166 }
156 167
157 void TraySettings::DestroyDefaultView() { 168 void TraySettings::DestroyDefaultView() {
158 default_view_ = NULL; 169 default_view_ = NULL;
159 } 170 }
160 171
161 void TraySettings::DestroyDetailedView() { 172 void TraySettings::DestroyDetailedView() {
162 } 173 }
163 174
164 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) { 175 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) {
165 } 176 }
166 177
167 } // namespace ash 178 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698