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

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

Issue 2673333002: Fix regression where no IMEs appear in the opt-in IME menu (Closed)
Patch Set: 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"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 views::CreateSolidSidedBorder(0, 0, kSeparatorWidth, 0, 145 views::CreateSolidSidedBorder(0, 0, kSeparatorWidth, 0,
146 kHorizontalSeparatorColor), 146 kHorizontalSeparatorColor),
147 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, 0))); 147 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, 0)));
148 auto* box_layout = 148 auto* box_layout =
149 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); 149 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
150 box_layout->set_minimum_cross_axis_size( 150 box_layout->set_minimum_cross_axis_size(
151 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); 151 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT));
152 SetLayoutManager(box_layout); 152 SetLayoutManager(box_layout);
153 auto title_label = 153 auto title_label =
154 new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME)); 154 new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME));
155 title_label->SetBorder(views::CreateEmptyBorder( 155 title_label->SetBorder(
156 0, kMenuEdgeEffectivePadding, kTrayMenuBottomRowPadding, 0)); 156 views::CreateEmptyBorder(0, kMenuEdgeEffectivePadding, 1, 0));
157 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 157 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
158 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE); 158 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE);
159 style.SetupLabel(title_label); 159 style.SetupLabel(title_label);
160 160
161 AddChildView(title_label); 161 AddChildView(title_label);
162 box_layout->SetFlexForView(title_label, 1); 162 box_layout->SetFlexForView(title_label, 1);
163 163
164 if (show_settings_button) { 164 if (show_settings_button) {
165 settings_button_ = CreateImeMenuButton( 165 settings_button_ = CreateImeMenuButton(
166 this, kSystemMenuSettingsIcon, IDS_ASH_STATUS_TRAY_IME_SETTINGS, 0); 166 this, kSystemMenuSettingsIcon, IDS_ASH_STATUS_TRAY_IME_SETTINGS, 0);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 SystemMenuButton* voice_button_; 329 SystemMenuButton* voice_button_;
330 SystemMenuButton* settings_button_; 330 SystemMenuButton* settings_button_;
331 HoverHighlightView* one_settings_button_view_; 331 HoverHighlightView* one_settings_button_view_;
332 332
333 DISALLOW_COPY_AND_ASSIGN(ImeButtonsView); 333 DISALLOW_COPY_AND_ASSIGN(ImeButtonsView);
334 }; 334 };
335 335
336 // The list view that contains the selected IME and property items. 336 // The list view that contains the selected IME and property items.
337 class ImeMenuListView : public ImeListView { 337 class ImeMenuListView : public ImeListView {
338 public: 338 public:
339 ImeMenuListView(SystemTrayItem* owner, 339 ImeMenuListView(SystemTrayItem* owner) : ImeListView(owner) {
340 bool show_keyboard_toggle,
341 SingleImeBehavior single_ime_behavior)
342 : ImeListView(owner, show_keyboard_toggle, single_ime_behavior) {
343 set_should_focus_ime_after_selection_with_keyboard(true); 340 set_should_focus_ime_after_selection_with_keyboard(true);
344 } 341 }
345 342
346 ~ImeMenuListView() override {} 343 ~ImeMenuListView() override {}
347 344
348 protected: 345 protected:
349 void Layout() override { 346 void Layout() override {
350 gfx::Range height_range = GetImeListViewRange(); 347 gfx::Range height_range = GetImeListViewRange();
351 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 348 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
352 scroller()->ClipHeightTo(height_range.start(), height_range.end()); 349 scroller()->ClipHeightTo(height_range.start(), height_range.end());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // In the material design, we will add a title item with a separator on the 427 // In the material design, we will add a title item with a separator on the
431 // top of the IME menu. 428 // top of the IME menu.
432 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 429 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
433 bubble_view->AddChildView( 430 bubble_view->AddChildView(
434 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons())); 431 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons()));
435 } else { 432 } else {
436 bubble_view->set_margins(gfx::Insets(7, 0, 0, 0)); 433 bubble_view->set_margins(gfx::Insets(7, 0, 0, 0));
437 } 434 }
438 435
439 // Adds IME list to the bubble. 436 // Adds IME list to the bubble.
440 ime_list_view_ = new ImeMenuListView(nullptr, ShouldShowKeyboardToggle(), 437 ime_list_view_ = new ImeMenuListView(nullptr);
441 ImeListView::SHOW_SINGLE_IME); 438 ime_list_view_->Init(ShouldShowKeyboardToggle(),
439 ImeListView::SHOW_SINGLE_IME);
442 bubble_view->AddChildView(ime_list_view_); 440 bubble_view->AddChildView(ime_list_view_);
443 441
444 if (ShouldShowEmojiHandwritingVoiceButtons()) { 442 if (ShouldShowEmojiHandwritingVoiceButtons()) {
445 bubble_view->AddChildView(new ImeButtonsView(this, true, true, true, true)); 443 bubble_view->AddChildView(new ImeButtonsView(this, true, true, true, true));
446 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { 444 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) {
447 // For MD, we don't need |ImeButtonsView| as the settings button will be 445 // For MD, we don't need |ImeButtonsView| as the settings button will be
448 // shown in the title row. 446 // shown in the title row.
449 bubble_view->AddChildView( 447 bubble_view->AddChildView(
450 new ImeButtonsView(this, false, false, false, true)); 448 new ImeButtonsView(this, false, false, false, true));
451 } 449 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_); 660 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_);
663 661
664 // Updates the tray label based on the current input method. 662 // Updates the tray label based on the current input method.
665 if (current_ime_.third_party) 663 if (current_ime_.third_party)
666 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); 664 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*"));
667 else 665 else
668 label_->SetText(current_ime_.short_name); 666 label_->SetText(current_ime_.short_name);
669 } 667 }
670 668
671 } // namespace ash 669 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_list_view.cc ('k') | ash/common/system/ime/tray_ime_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698