OLD | NEW |
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 Loading... |
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 = ash::Shell::GetInstance() |
| 45 ->session_state_delegate() |
| 46 ->IsInSecondaryLoginScreen(); |
| 47 |
43 if (login_status_ != user::LOGGED_IN_NONE && | 48 if (login_status_ != user::LOGGED_IN_NONE && |
44 login_status_ != user::LOGGED_IN_LOCKED) { | 49 login_status_ != user::LOGGED_IN_LOCKED && !userAddingRunning) { |
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 10 matching lines...) Expand all Loading... |
65 OnPowerStatusChanged(); | 70 OnPowerStatusChanged(); |
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 { |
| 80 bool userAddingRunning = ash::Shell::GetInstance() |
| 81 ->session_state_delegate() |
| 82 ->IsInSecondaryLoginScreen(); |
| 83 |
75 if (login_status_ == user::LOGGED_IN_NONE || | 84 if (login_status_ == user::LOGGED_IN_NONE || |
76 login_status_ == user::LOGGED_IN_LOCKED) | 85 login_status_ == user::LOGGED_IN_LOCKED || userAddingRunning) |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 default_view_ = NULL; | 167 default_view_ = NULL; |
159 } | 168 } |
160 | 169 |
161 void TraySettings::DestroyDetailedView() { | 170 void TraySettings::DestroyDetailedView() { |
162 } | 171 } |
163 | 172 |
164 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 173 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
165 } | 174 } |
166 | 175 |
167 } // namespace ash | 176 } // namespace ash |
OLD | NEW |