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()->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) | 120 !WmShell::Get() |
| 121 ->GetSessionStateDelegate() |
| 122 ->IsInSecondaryLoginScreen()) { |
121 AppendSettings(); | 123 AppendSettings(); |
122 AppendHeaderEntry(); | 124 } |
| 125 |
| 126 CreateTitleRow(IDS_ASH_STATUS_TRAY_IME); |
123 } | 127 } |
124 | 128 |
125 private: | 129 private: |
126 // ImeListView: | 130 // ImeListView: |
127 void OnViewClicked(views::View* sender) override { | 131 void HandleViewClicked(views::View* view) override { |
128 ImeListView::OnViewClicked(sender); | 132 ImeListView::HandleViewClicked(view); |
129 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 133 if (view == settings_) { |
130 if (sender == footer()->content()) { | |
131 TransitionToDefaultView(); | |
132 } else if (sender == settings_) { | |
133 WmShell::Get()->RecordUserMetricsAction( | 134 WmShell::Get()->RecordUserMetricsAction( |
134 UMA_STATUS_AREA_IME_SHOW_DETAILED); | 135 UMA_STATUS_AREA_IME_SHOW_DETAILED); |
135 delegate->ShowIMESettings(); | 136 WmShell::Get()->system_tray_delegate()->ShowIMESettings(); |
136 } | 137 } |
137 } | 138 } |
138 | 139 |
139 void AppendHeaderEntry() { CreateSpecialRow(IDS_ASH_STATUS_TRAY_IME, this); } | |
140 | |
141 void AppendSettings() { | 140 void AppendSettings() { |
142 HoverHighlightView* container = new HoverHighlightView(this); | 141 HoverHighlightView* container = new HoverHighlightView(this); |
143 container->AddLabel( | 142 container->AddLabel( |
144 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 143 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
145 IDS_ASH_STATUS_TRAY_IME_SETTINGS), | 144 IDS_ASH_STATUS_TRAY_IME_SETTINGS), |
146 gfx::ALIGN_LEFT, false /* highlight */); | 145 gfx::ALIGN_LEFT, false /* highlight */); |
147 AddChildView(container); | 146 AddChildView(container); |
148 settings_ = container; | 147 settings_ = container; |
149 } | 148 } |
150 | 149 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 else | 298 else |
300 Update(); | 299 Update(); |
301 } | 300 } |
302 | 301 |
303 bool TrayIME::ShouldDefaultViewBeVisible() { | 302 bool TrayIME::ShouldDefaultViewBeVisible() { |
304 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || | 303 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || |
305 ShouldShowKeyboardToggle()); | 304 ShouldShowKeyboardToggle()); |
306 } | 305 } |
307 | 306 |
308 } // namespace ash | 307 } // namespace ash |
OLD | NEW |