OLD | NEW |
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_menu_tray.h" | 5 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/ash_constants.h" | 8 #include "ash/common/ash_constants.h" |
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 // In the material design, we will add a title item with a separator on the | 340 // In the material design, we will add a title item with a separator on the |
341 // top of the IME menu. | 341 // top of the IME menu. |
342 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 342 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
343 bubble_view->AddChildView( | 343 bubble_view->AddChildView( |
344 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons())); | 344 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons())); |
345 } else { | 345 } else { |
346 bubble_view->set_margins(gfx::Insets(7, 0, 0, 0)); | 346 bubble_view->set_margins(gfx::Insets(7, 0, 0, 0)); |
347 } | 347 } |
348 | 348 |
| 349 const gfx::Range height_range = GetImeListViewRange(); |
| 350 |
349 // Adds IME list to the bubble. | 351 // Adds IME list to the bubble. |
350 ime_list_view_ = new ImeListView(nullptr, ShouldShowKeyboardToggle(), | 352 ime_list_view_ = new ImeListView(nullptr, ShouldShowKeyboardToggle(), |
351 ImeListView::SHOW_SINGLE_IME); | 353 ImeListView::SHOW_SINGLE_IME, height_range); |
352 | 354 |
353 uint32_t current_height = ime_list_view_->scroll_content()->height(); | 355 uint32_t current_height = ime_list_view_->scroll_content()->height(); |
354 const gfx::Range height_range = GetImeListViewRange(); | 356 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
355 | 357 if (current_height > height_range.end()) { |
356 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 358 ime_list_view_->scroller()->SetFixedSize( |
357 ime_list_view_->scroller()->ClipHeightTo(height_range.start(), | 359 gfx::Size(minimum_menu_width, height_range.end())); |
358 height_range.end()); | 360 } else if (current_height < height_range.start()) { |
359 } else if (current_height > height_range.end()) { | 361 ime_list_view_->scroller()->SetFixedSize( |
360 ime_list_view_->scroller()->SetFixedSize( | 362 gfx::Size(minimum_menu_width, height_range.start())); |
361 gfx::Size(minimum_menu_width, height_range.end())); | 363 } |
362 } else if (current_height < height_range.start()) { | |
363 ime_list_view_->scroller()->SetFixedSize( | |
364 gfx::Size(minimum_menu_width, height_range.start())); | |
365 } | 364 } |
366 bubble_view->AddChildView(ime_list_view_); | 365 bubble_view->AddChildView(ime_list_view_); |
367 | 366 |
368 // The bottom view that contains buttons are not supported in login/lock | 367 // The bottom view that contains buttons are not supported in login/lock |
369 // screen. | 368 // screen. |
370 if (!IsInLoginOrLockScreen()) { | 369 if (!IsInLoginOrLockScreen()) { |
371 if (ShouldShowEmojiHandwritingVoiceButtons()) { | 370 if (ShouldShowEmojiHandwritingVoiceButtons()) { |
372 bubble_view->AddChildView( | 371 bubble_view->AddChildView( |
373 new ImeButtonsView(this, true, true, true, true)); | 372 new ImeButtonsView(this, true, true, true, true)); |
374 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { | 373 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 561 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
563 | 562 |
564 // Updates the tray label based on the current input method. | 563 // Updates the tray label based on the current input method. |
565 if (current_ime_.third_party) | 564 if (current_ime_.third_party) |
566 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 565 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
567 else | 566 else |
568 label_->SetText(current_ime_.short_name); | 567 label_->SetText(current_ime_.short_name); |
569 } | 568 } |
570 | 569 |
571 } // namespace ash | 570 } // namespace ash |
OLD | NEW |