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

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

Issue 2671063002: Remove FixedSizedScrollView. (Closed)
Patch Set: rebase Created 3 years, 10 months 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_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"
11 #include "ash/common/shelf/wm_shelf.h" 11 #include "ash/common/shelf/wm_shelf.h"
12 #include "ash/common/shelf/wm_shelf_util.h" 12 #include "ash/common/shelf/wm_shelf_util.h"
13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" 13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
14 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
15 #include "ash/common/system/tray/hover_highlight_view.h" 14 #include "ash/common/system/tray/hover_highlight_view.h"
16 #include "ash/common/system/tray/system_menu_button.h" 15 #include "ash/common/system/tray/system_menu_button.h"
17 #include "ash/common/system/tray/system_tray_controller.h" 16 #include "ash/common/system/tray/system_tray_controller.h"
18 #include "ash/common/system/tray/system_tray_delegate.h" 17 #include "ash/common/system/tray/system_tray_delegate.h"
19 #include "ash/common/system/tray/system_tray_notifier.h" 18 #include "ash/common/system/tray/system_tray_notifier.h"
20 #include "ash/common/system/tray/tray_constants.h" 19 #include "ash/common/system/tray/tray_constants.h"
21 #include "ash/common/system/tray/tray_popup_item_style.h" 20 #include "ash/common/system/tray/tray_popup_item_style.h"
22 #include "ash/common/system/tray/tray_popup_utils.h" 21 #include "ash/common/system/tray/tray_popup_utils.h"
23 #include "ash/common/system/tray/tray_utils.h" 22 #include "ash/common/system/tray/tray_utils.h"
24 #include "ash/common/wm_lookup.h" 23 #include "ash/common/wm_lookup.h"
(...skipping 10 matching lines...) Expand all
35 #include "ui/base/ime/text_input_client.h" 34 #include "ui/base/ime/text_input_client.h"
36 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
38 #include "ui/gfx/paint_vector_icon.h" 37 #include "ui/gfx/paint_vector_icon.h"
39 #include "ui/gfx/range/range.h" 38 #include "ui/gfx/range/range.h"
40 #include "ui/gfx/vector_icons_public.h" 39 #include "ui/gfx/vector_icons_public.h"
41 #include "ui/keyboard/keyboard_controller.h" 40 #include "ui/keyboard/keyboard_controller.h"
42 #include "ui/keyboard/keyboard_util.h" 41 #include "ui/keyboard/keyboard_util.h"
43 #include "ui/views/controls/button/button.h" 42 #include "ui/views/controls/button/button.h"
44 #include "ui/views/controls/label.h" 43 #include "ui/views/controls/label.h"
44 #include "ui/views/controls/scroll_view.h"
45 #include "ui/views/controls/separator.h" 45 #include "ui/views/controls/separator.h"
46 #include "ui/views/layout/box_layout.h" 46 #include "ui/views/layout/box_layout.h"
47 47
48 using chromeos::input_method::InputMethodManager; 48 using chromeos::input_method::InputMethodManager;
49 49
50 namespace ash { 50 namespace ash {
51 51
52 namespace { 52 namespace {
53 // Returns the height range of ImeListView. 53 // Returns the height range of ImeListView.
54 gfx::Range GetImeListViewRange() { 54 gfx::Range GetImeListViewRange() {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 public: 338 public:
339 ImeMenuListView(SystemTrayItem* owner) : ImeListView(owner) { 339 ImeMenuListView(SystemTrayItem* owner) : ImeListView(owner) {
340 set_should_focus_ime_after_selection_with_keyboard(true); 340 set_should_focus_ime_after_selection_with_keyboard(true);
341 } 341 }
342 342
343 ~ImeMenuListView() override {} 343 ~ImeMenuListView() override {}
344 344
345 protected: 345 protected:
346 void Layout() override { 346 void Layout() override {
347 gfx::Range height_range = GetImeListViewRange(); 347 gfx::Range height_range = GetImeListViewRange();
348 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 348 scroller()->ClipHeightTo(height_range.start(), height_range.end());
349 scroller()->ClipHeightTo(height_range.start(), height_range.end());
350 } else {
351 uint32_t current_height = scroll_content()->height();
352 int minimum_menu_width = GetMinimumMenuWidth();
353 if (current_height > height_range.end()) {
354 scroller()->SetFixedSize(
355 gfx::Size(minimum_menu_width, height_range.end()));
356 } else if (current_height < height_range.start()) {
357 scroller()->SetFixedSize(
358 gfx::Size(minimum_menu_width, height_range.start()));
359 }
360 }
361 ImeListView::Layout(); 349 ImeListView::Layout();
362 } 350 }
363 351
364 DISALLOW_COPY_AND_ASSIGN(ImeMenuListView); 352 DISALLOW_COPY_AND_ASSIGN(ImeMenuListView);
365 }; 353 };
366 354
367 } // namespace 355 } // namespace
368 356
369 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf) 357 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf)
370 : TrayBackgroundView(wm_shelf), 358 : TrayBackgroundView(wm_shelf),
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_); 648 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_);
661 649
662 // Updates the tray label based on the current input method. 650 // Updates the tray label based on the current input method.
663 if (current_ime_.third_party) 651 if (current_ime_.third_party)
664 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); 652 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*"));
665 else 653 else
666 label_->SetText(current_ime_.short_name); 654 label_->SetText(current_ime_.short_name);
667 } 655 }
668 656
669 } // namespace ash 657 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/cast/tray_cast.cc ('k') | ash/common/system/chromeos/network/network_state_list_detailed_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698