| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 views::CreateEmptyBorder(0, 0, kMenuSeparatorVerticalPadding, 0)); | 357 views::CreateEmptyBorder(0, 0, kMenuSeparatorVerticalPadding, 0)); |
| 358 bubble_view->AddChildView(separator); | 358 bubble_view->AddChildView(separator); |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Adds IME list to the bubble. | 361 // Adds IME list to the bubble. |
| 362 ime_list_view_ = | 362 ime_list_view_ = |
| 363 new ImeListView(nullptr, false, ImeListView::SHOW_SINGLE_IME); | 363 new ImeListView(nullptr, false, ImeListView::SHOW_SINGLE_IME); |
| 364 | 364 |
| 365 uint32_t current_height = ime_list_view_->scroll_content()->height(); | 365 uint32_t current_height = ime_list_view_->scroll_content()->height(); |
| 366 const gfx::Range height_range = GetImeListViewRange(); | 366 const gfx::Range height_range = GetImeListViewRange(); |
| 367 if (current_height > height_range.end()) { | 367 |
| 368 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| 369 ime_list_view_->scroller()->ClipHeightTo(height_range.start(), |
| 370 height_range.end()); |
| 371 } else if (current_height > height_range.end()) { |
| 368 ime_list_view_->scroller()->SetFixedSize( | 372 ime_list_view_->scroller()->SetFixedSize( |
| 369 gfx::Size(kTrayPopupMaxWidth, height_range.end())); | 373 gfx::Size(kTrayPopupMaxWidth, height_range.end())); |
| 370 } else if (MaterialDesignController::IsSystemTrayMenuMaterial() && | 374 } else if (current_height < height_range.start()) { |
| 371 current_height < height_range.start()) { | |
| 372 ime_list_view_->scroller()->SetFixedSize( | 375 ime_list_view_->scroller()->SetFixedSize( |
| 373 gfx::Size(kTrayPopupMaxWidth, height_range.start())); | 376 gfx::Size(kTrayPopupMaxWidth, height_range.start())); |
| 374 } | 377 } |
| 375 bubble_view->AddChildView(ime_list_view_); | 378 bubble_view->AddChildView(ime_list_view_); |
| 376 | 379 |
| 377 // The bottom view that contains buttons are not supported in login/lock | 380 // The bottom view that contains buttons are not supported in login/lock |
| 378 // screen. | 381 // screen. |
| 379 if (!IsInLoginOrLockScreen()) { | 382 if (!IsInLoginOrLockScreen()) { |
| 380 if (ShouldShowEmojiHandwritingVoiceButtons()) { | 383 if (ShouldShowEmojiHandwritingVoiceButtons()) { |
| 381 bubble_view->AddChildView( | 384 bubble_view->AddChildView( |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 583 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
| 581 | 584 |
| 582 // Updates the tray label based on the current input method. | 585 // Updates the tray label based on the current input method. |
| 583 if (current_ime_.third_party) | 586 if (current_ime_.third_party) |
| 584 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 587 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
| 585 else | 588 else |
| 586 label_->SetText(current_ime_.short_name); | 589 label_->SetText(current_ime_.short_name); |
| 587 } | 590 } |
| 588 | 591 |
| 589 } // namespace ash | 592 } // namespace ash |
| OLD | NEW |