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

Side by Side Diff: ash/common/system/ime/tray_ime_chromeos.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
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_menu_tray.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ime/tray_ime_chromeos.h" 5 #include "ash/common/system/ime/tray_ime_chromeos.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 SetImage( 104 SetImage(
105 gfx::CreateVectorIcon(kSystemMenuKeyboardIcon, style->GetIconColor())); 105 gfx::CreateVectorIcon(kSystemMenuKeyboardIcon, style->GetIconColor()));
106 } 106 }
107 107
108 private: 108 private:
109 DISALLOW_COPY_AND_ASSIGN(IMEDefaultView); 109 DISALLOW_COPY_AND_ASSIGN(IMEDefaultView);
110 }; 110 };
111 111
112 class IMEDetailedView : public ImeListView { 112 class IMEDetailedView : public ImeListView {
113 public: 113 public:
114 IMEDetailedView(SystemTrayItem* owner, 114 IMEDetailedView(SystemTrayItem* owner, LoginStatus login)
115 LoginStatus login, 115 : ImeListView(owner),
116 bool show_keyboard_toggle)
117 : ImeListView(owner, show_keyboard_toggle, ImeListView::HIDE_SINGLE_IME),
118 login_(login), 116 login_(login),
119 settings_(nullptr), 117 settings_(nullptr),
120 settings_button_(nullptr) { 118 settings_button_(nullptr) {}
121 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
122 IMEInfoList list;
123 delegate->GetAvailableIMEList(&list);
124 IMEPropertyInfoList property_list;
125 delegate->GetCurrentIMEProperties(&property_list);
126 Update(list, property_list, show_keyboard_toggle,
127 ImeListView::HIDE_SINGLE_IME);
128 }
129 119
130 ~IMEDetailedView() override {} 120 ~IMEDetailedView() override {}
131 121
132 void Update(const IMEInfoList& list, 122 void Update(const IMEInfoList& list,
133 const IMEPropertyInfoList& property_list, 123 const IMEPropertyInfoList& property_list,
134 bool show_keyboard_toggle, 124 bool show_keyboard_toggle,
135 SingleImeBehavior single_ime_behavior) override { 125 SingleImeBehavior single_ime_behavior) override {
136 ImeListView::Update(list, property_list, show_keyboard_toggle, 126 ImeListView::Update(list, property_list, show_keyboard_toggle,
137 single_ime_behavior); 127 single_ime_behavior);
138 if (!MaterialDesignController::IsSystemTrayMenuMaterial() && 128 if (!MaterialDesignController::IsSystemTrayMenuMaterial() &&
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 views::View* TrayIME::CreateDefaultView(LoginStatus status) { 283 views::View* TrayIME::CreateDefaultView(LoginStatus status) {
294 CHECK(default_ == NULL); 284 CHECK(default_ == NULL);
295 default_ = 285 default_ =
296 new tray::IMEDefaultView(this, GetDefaultViewLabel(ime_list_.size() > 1)); 286 new tray::IMEDefaultView(this, GetDefaultViewLabel(ime_list_.size() > 1));
297 default_->SetVisible(ShouldDefaultViewBeVisible()); 287 default_->SetVisible(ShouldDefaultViewBeVisible());
298 return default_; 288 return default_;
299 } 289 }
300 290
301 views::View* TrayIME::CreateDetailedView(LoginStatus status) { 291 views::View* TrayIME::CreateDetailedView(LoginStatus status) {
302 CHECK(detailed_ == NULL); 292 CHECK(detailed_ == NULL);
303 detailed_ = 293 detailed_ = new tray::IMEDetailedView(this, status);
304 new tray::IMEDetailedView(this, status, ShouldShowKeyboardToggle()); 294 detailed_->Init(ShouldShowKeyboardToggle(), ImeListView::HIDE_SINGLE_IME);
305 return detailed_; 295 return detailed_;
306 } 296 }
307 297
308 void TrayIME::DestroyTrayView() { 298 void TrayIME::DestroyTrayView() {
309 tray_label_ = NULL; 299 tray_label_ = NULL;
310 } 300 }
311 301
312 void TrayIME::DestroyDefaultView() { 302 void TrayIME::DestroyDefaultView() {
313 default_ = NULL; 303 default_ = NULL;
314 } 304 }
(...skipping 28 matching lines...) Expand all
343 else 333 else
344 Update(); 334 Update();
345 } 335 }
346 336
347 bool TrayIME::ShouldDefaultViewBeVisible() { 337 bool TrayIME::ShouldDefaultViewBeVisible() {
348 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || 338 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 ||
349 ShouldShowKeyboardToggle()); 339 ShouldShowKeyboardToggle());
350 } 340 }
351 341
352 } // namespace ash 342 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_menu_tray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698