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

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: Stored result of check on multiple signin screen to local variable 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 16 matching lines...) Expand all
33 explicit SettingsDefaultView(user::LoginStatus status) 34 explicit SettingsDefaultView(user::LoginStatus status)
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;
44 bool userAddingRunning =
45 (ash::Shell::GetInstance()
46 ->session_state_delegate()
47 ->GetSessionState() ==
48 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY);
49
43 if (login_status_ != user::LOGGED_IN_NONE && 50 if (login_status_ != user::LOGGED_IN_NONE &&
44 login_status_ != user::LOGGED_IN_LOCKED) { 51 login_status_ != user::LOGGED_IN_LOCKED && !userAddingRunning) {
45 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 52 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
46 views::ImageView* icon = 53 views::ImageView* icon =
47 new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight); 54 new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
48 icon->SetImage( 55 icon->SetImage(
49 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); 56 rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia());
50 icon->set_id(test::kSettingsTrayItemViewId); 57 icon->set_id(test::kSettingsTrayItemViewId);
51 AddChildView(icon); 58 AddChildView(icon);
52 59
53 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); 60 base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS);
54 label_ = new views::Label(text); 61 label_ = new views::Label(text);
(...skipping 10 matching lines...) Expand all
65 OnPowerStatusChanged(); 72 OnPowerStatusChanged();
66 } 73 }
67 } 74 }
68 75
69 virtual ~SettingsDefaultView() { 76 virtual ~SettingsDefaultView() {
70 PowerStatus::Get()->RemoveObserver(this); 77 PowerStatus::Get()->RemoveObserver(this);
71 } 78 }
72 79
73 // Overridden from ash::ActionableView. 80 // Overridden from ash::ActionableView.
74 virtual bool PerformAction(const ui::Event& event) OVERRIDE { 81 virtual bool PerformAction(const ui::Event& event) OVERRIDE {
82 bool userAddingRunning =
83 (ash::Shell::GetInstance()
84 ->session_state_delegate()
85 ->GetSessionState() ==
86 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY);
87
75 if (login_status_ == user::LOGGED_IN_NONE || 88 if (login_status_ == user::LOGGED_IN_NONE ||
76 login_status_ == user::LOGGED_IN_LOCKED) 89 login_status_ == user::LOGGED_IN_LOCKED || userAddingRunning)
77 return false; 90 return false;
78 91
79 ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings(); 92 ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings();
80 return true; 93 return true;
81 } 94 }
82 95
83 // Overridden from views::View. 96 // Overridden from views::View.
84 virtual void Layout() OVERRIDE { 97 virtual void Layout() OVERRIDE {
85 views::View::Layout(); 98 views::View::Layout();
86 99
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 142 }
130 143
131 TraySettings::~TraySettings() { 144 TraySettings::~TraySettings() {
132 } 145 }
133 146
134 views::View* TraySettings::CreateTrayView(user::LoginStatus status) { 147 views::View* TraySettings::CreateTrayView(user::LoginStatus status) {
135 return NULL; 148 return NULL;
136 } 149 }
137 150
138 views::View* TraySettings::CreateDefaultView(user::LoginStatus status) { 151 views::View* TraySettings::CreateDefaultView(user::LoginStatus status) {
139 if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED) && 152 bool userAddingRunning =
153 (ash::Shell::GetInstance()->session_state_delegate()->GetSessionState() ==
154 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY);
155
oshima 2014/08/01 20:31:22 same here. this can be handled by ShouldShowSettin
Roman Sorokin (ftl) 2014/08/05 13:44:09 Done.
156 if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED ||
157 userAddingRunning) &&
140 !PowerStatus::Get()->IsBatteryPresent()) 158 !PowerStatus::Get()->IsBatteryPresent())
141 return NULL; 159 return NULL;
142 if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings()) 160 if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings())
143 return NULL; 161 return NULL;
144 CHECK(default_view_ == NULL); 162 CHECK(default_view_ == NULL);
145 default_view_ = new tray::SettingsDefaultView(status); 163 default_view_ = new tray::SettingsDefaultView(status);
146 return default_view_; 164 return default_view_;
147 } 165 }
148 166
149 views::View* TraySettings::CreateDetailedView(user::LoginStatus status) { 167 views::View* TraySettings::CreateDetailedView(user::LoginStatus status) {
150 NOTIMPLEMENTED(); 168 NOTIMPLEMENTED();
151 return NULL; 169 return NULL;
152 } 170 }
153 171
154 void TraySettings::DestroyTrayView() { 172 void TraySettings::DestroyTrayView() {
155 } 173 }
156 174
157 void TraySettings::DestroyDefaultView() { 175 void TraySettings::DestroyDefaultView() {
158 default_view_ = NULL; 176 default_view_ = NULL;
159 } 177 }
160 178
161 void TraySettings::DestroyDetailedView() { 179 void TraySettings::DestroyDetailedView() {
162 } 180 }
163 181
164 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) { 182 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) {
165 } 183 }
166 184
167 } // namespace ash 185 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698