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