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

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_list_view.cc

Issue 2541743004: Set ImeListView's scrollable range when updating (Closed)
Patch Set: Set ImeListView's scrollable range when updating. Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/ime_menu/ime_list_view.h" 5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
8 #include "ash/common/system/tray/hover_highlight_view.h" 9 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/ime_info.h" 10 #include "ash/common/system/tray/ime_info.h"
10 #include "ash/common/system/tray/system_menu_button.h" 11 #include "ash/common/system/tray/system_menu_button.h"
11 #include "ash/common/system/tray/system_tray_delegate.h" 12 #include "ash/common/system/tray/system_tray_delegate.h"
12 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
13 #include "ash/common/system/tray/tray_details_view.h" 14 #include "ash/common/system/tray/tray_details_view.h"
14 #include "ash/common/system/tray/tray_popup_header_button.h" 15 #include "ash/common/system/tray/tray_popup_header_button.h"
15 #include "ash/common/system/tray/tray_popup_item_style.h" 16 #include "ash/common/system/tray/tray_popup_item_style.h"
16 #include "ash/common/system/tray/tray_popup_utils.h" 17 #include "ash/common/system/tray/tray_popup_utils.h"
17 #include "ash/common/system/tray/tri_view.h" 18 #include "ash/common/system/tray/tri_view.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 views::Label* label_; 246 views::Label* label_;
246 247
247 // ToggleButton to toggle keyboard on or off. 248 // ToggleButton to toggle keyboard on or off.
248 views::ToggleButton* toggle_; 249 views::ToggleButton* toggle_;
249 250
250 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView); 251 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView);
251 }; 252 };
252 253
253 ImeListView::ImeListView(SystemTrayItem* owner, 254 ImeListView::ImeListView(SystemTrayItem* owner,
254 bool show_keyboard_toggle, 255 bool show_keyboard_toggle,
255 SingleImeBehavior single_ime_behavior) 256 SingleImeBehavior single_ime_behavior,
256 : TrayDetailsView(owner) { 257 const gfx::Range& scrollable_range)
258 : TrayDetailsView(owner), scrollable_range_(scrollable_range) {
257 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 259 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
258 IMEInfoList list; 260 IMEInfoList list;
259 delegate->GetAvailableIMEList(&list); 261 delegate->GetAvailableIMEList(&list);
260 IMEPropertyInfoList property_list; 262 IMEPropertyInfoList property_list;
261 delegate->GetCurrentIMEProperties(&property_list); 263 delegate->GetCurrentIMEProperties(&property_list);
262 Update(list, property_list, show_keyboard_toggle, single_ime_behavior); 264 Update(list, property_list, show_keyboard_toggle, single_ime_behavior);
263 } 265 }
264 266
265 ImeListView::~ImeListView() {} 267 ImeListView::~ImeListView() {}
266 268
(...skipping 20 matching lines...) Expand all
287 if (show_keyboard_toggle) { 289 if (show_keyboard_toggle) {
288 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 290 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
289 PrependMaterialKeyboardStatus(); 291 PrependMaterialKeyboardStatus();
290 } else { 292 } else {
291 if (list.size() > 1 || !property_list.empty()) 293 if (list.size() > 1 || !property_list.empty())
292 AddScrollSeparator(); 294 AddScrollSeparator();
293 AppendKeyboardStatus(); 295 AppendKeyboardStatus();
294 } 296 }
295 } 297 }
296 298
299 if (MaterialDesignController::IsSystemTrayMenuMaterial() &&
300 scrollable_range_.IsValid()) {
301 scroller()->ClipHeightTo(scrollable_range_.start(),
302 scrollable_range_.end());
303 }
304
297 Layout(); 305 Layout();
tdanderson 2016/12/06 23:38:19 Would it be possible to move the code from lines 2
Azure Wei 2016/12/07 00:58:33 GetImeListViewRange() is kind of opt-in menu speci
298 SchedulePaint(); 306 SchedulePaint();
299 } 307 }
300 308
301 void ImeListView::ResetImeListView() { 309 void ImeListView::ResetImeListView() {
302 // Children are removed from the view hierarchy and deleted in Reset(). 310 // Children are removed from the view hierarchy and deleted in Reset().
303 Reset(); 311 TrayDetailsView::Reset();
tdanderson 2016/12/06 23:38:19 Adding TrayDetailsView:: shouldn't be necessary he
Azure Wei 2016/12/07 00:58:33 Reverted.
304 material_keyboard_status_view_ = nullptr; 312 material_keyboard_status_view_ = nullptr;
305 keyboard_status_ = nullptr; 313 keyboard_status_ = nullptr;
306 } 314 }
307 315
308 void ImeListView::AppendIMEList(const IMEInfoList& list) { 316 void ImeListView::AppendIMEList(const IMEInfoList& list) {
309 DCHECK(ime_map_.empty()); 317 DCHECK(ime_map_.empty());
310 for (size_t i = 0; i < list.size(); i++) { 318 for (size_t i = 0; i < list.size(); i++) {
311 HoverHighlightView* container = 319 HoverHighlightView* container =
312 new SelectableHoverHighlightView(this, list[i].name, list[i].selected); 320 new SelectableHoverHighlightView(this, list[i].name, list[i].selected);
313 scroll_content()->AddChildView(container); 321 scroll_content()->AddChildView(container);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 420
413 void ImeListView::HandleButtonPressed(views::Button* sender, 421 void ImeListView::HandleButtonPressed(views::Button* sender,
414 const ui::Event& event) { 422 const ui::Event& event) {
415 if (material_keyboard_status_view_ && 423 if (material_keyboard_status_view_ &&
416 sender == material_keyboard_status_view_->toggle()) { 424 sender == material_keyboard_status_view_->toggle()) {
417 WmShell::Get()->ToggleIgnoreExternalKeyboard(); 425 WmShell::Get()->ToggleIgnoreExternalKeyboard();
418 } 426 }
419 } 427 }
420 428
421 } // namespace ash 429 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_list_view.h ('k') | ash/common/system/chromeos/ime_menu/ime_menu_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698