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/common/system/ime/tray_ime_chromeos.h" | 5 #include "ash/common/system/ime/tray_ime_chromeos.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 ~IMEDetailedView() override {} | 111 ~IMEDetailedView() override {} |
112 | 112 |
113 void Update(const IMEInfoList& list, | 113 void Update(const IMEInfoList& list, |
114 const IMEPropertyInfoList& property_list, | 114 const IMEPropertyInfoList& property_list, |
115 bool show_keyboard_toggle, | 115 bool show_keyboard_toggle, |
116 SingleImeBehavior single_ime_behavior) override { | 116 SingleImeBehavior single_ime_behavior) override { |
117 ImeListView::Update(list, property_list, show_keyboard_toggle, | 117 ImeListView::Update(list, property_list, show_keyboard_toggle, |
118 single_ime_behavior); | 118 single_ime_behavior); |
119 if (login_ != LoginStatus::NOT_LOGGED_IN && login_ != LoginStatus::LOCKED && | 119 if (login_ != LoginStatus::NOT_LOGGED_IN && login_ != LoginStatus::LOCKED && |
120 !WmShell::Get() | 120 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) |
121 ->GetSessionStateDelegate() | |
122 ->IsInSecondaryLoginScreen()) { | |
123 AppendSettings(); | 121 AppendSettings(); |
124 } | 122 AppendHeaderEntry(); |
125 | |
126 CreateTitleRow(IDS_ASH_STATUS_TRAY_IME); | |
127 } | 123 } |
128 | 124 |
129 private: | 125 private: |
130 // ImeListView: | 126 // ImeListView: |
131 void HandleViewClicked(views::View* view) override { | 127 void OnViewClicked(views::View* sender) override { |
132 ImeListView::HandleViewClicked(view); | 128 ImeListView::OnViewClicked(sender); |
133 if (view == settings_) { | 129 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| 130 if (sender == footer()->content()) { |
| 131 TransitionToDefaultView(); |
| 132 } else if (sender == settings_) { |
134 WmShell::Get()->RecordUserMetricsAction( | 133 WmShell::Get()->RecordUserMetricsAction( |
135 UMA_STATUS_AREA_IME_SHOW_DETAILED); | 134 UMA_STATUS_AREA_IME_SHOW_DETAILED); |
136 WmShell::Get()->system_tray_delegate()->ShowIMESettings(); | 135 delegate->ShowIMESettings(); |
137 } | 136 } |
138 } | 137 } |
139 | 138 |
| 139 void AppendHeaderEntry() { CreateSpecialRow(IDS_ASH_STATUS_TRAY_IME, this); } |
| 140 |
140 void AppendSettings() { | 141 void AppendSettings() { |
141 HoverHighlightView* container = new HoverHighlightView(this); | 142 HoverHighlightView* container = new HoverHighlightView(this); |
142 container->AddLabel( | 143 container->AddLabel( |
143 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 144 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
144 IDS_ASH_STATUS_TRAY_IME_SETTINGS), | 145 IDS_ASH_STATUS_TRAY_IME_SETTINGS), |
145 gfx::ALIGN_LEFT, false /* highlight */); | 146 gfx::ALIGN_LEFT, false /* highlight */); |
146 AddChildView(container); | 147 AddChildView(container); |
147 settings_ = container; | 148 settings_ = container; |
148 } | 149 } |
149 | 150 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 else | 299 else |
299 Update(); | 300 Update(); |
300 } | 301 } |
301 | 302 |
302 bool TrayIME::ShouldDefaultViewBeVisible() { | 303 bool TrayIME::ShouldDefaultViewBeVisible() { |
303 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || | 304 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || |
304 ShouldShowKeyboardToggle()); | 305 ShouldShowKeyboardToggle()); |
305 } | 306 } |
306 | 307 |
307 } // namespace ash | 308 } // namespace ash |
OLD | NEW |