| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } // namespace | 297 } // namespace |
| 298 | 298 |
| 299 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf) | 299 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf) |
| 300 : TrayBackgroundView(wm_shelf), | 300 : TrayBackgroundView(wm_shelf), |
| 301 label_(new ImeMenuLabel()), | 301 label_(new ImeMenuLabel()), |
| 302 show_keyboard_(false), | 302 show_keyboard_(false), |
| 303 force_show_keyboard_(false), | 303 force_show_keyboard_(false), |
| 304 should_block_shelf_auto_hide_(false) { | 304 should_block_shelf_auto_hide_(false) { |
| 305 SetupLabelForTray(label_); | 305 SetupLabelForTray(label_); |
| 306 tray_container()->AddChildView(label_); | 306 tray_container()->AddChildView(label_); |
| 307 SetContentsBackground(); | 307 SetContentsBackground(true); |
| 308 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this); | 308 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this); |
| 309 } | 309 } |
| 310 | 310 |
| 311 ImeMenuTray::~ImeMenuTray() { | 311 ImeMenuTray::~ImeMenuTray() { |
| 312 if (bubble_) | 312 if (bubble_) |
| 313 bubble_->bubble_view()->reset_delegate(); | 313 bubble_->bubble_view()->reset_delegate(); |
| 314 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this); | 314 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void ImeMenuTray::ShowImeMenuBubble() { | 317 void ImeMenuTray::ShowImeMenuBubble() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 new ImeButtonsView(this, true, true, true, true)); | 365 new ImeButtonsView(this, true, true, true, true)); |
| 366 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { | 366 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| 367 // For MD, we don't need |ImeButtonsView| as the settings button will be | 367 // For MD, we don't need |ImeButtonsView| as the settings button will be |
| 368 // shown in the title row. | 368 // shown in the title row. |
| 369 bubble_view->AddChildView( | 369 bubble_view->AddChildView( |
| 370 new ImeButtonsView(this, false, false, false, true)); | 370 new ImeButtonsView(this, false, false, false, true)); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 bubble_.reset(new TrayBubbleWrapper(this, bubble_view)); | 374 bubble_.reset(new TrayBubbleWrapper(this, bubble_view)); |
| 375 SetDrawBackgroundAsActive(true); | 375 SetIsActive(true); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void ImeMenuTray::HideImeMenuBubble() { | 378 void ImeMenuTray::HideImeMenuBubble() { |
| 379 bubble_.reset(); | 379 bubble_.reset(); |
| 380 ime_list_view_ = nullptr; | 380 ime_list_view_ = nullptr; |
| 381 SetDrawBackgroundAsActive(false); | 381 SetIsActive(false); |
| 382 should_block_shelf_auto_hide_ = false; | 382 should_block_shelf_auto_hide_ = false; |
| 383 shelf()->UpdateAutoHideState(); | 383 shelf()->UpdateAutoHideState(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 bool ImeMenuTray::IsImeMenuBubbleShown() { | 386 bool ImeMenuTray::IsImeMenuBubbleShown() { |
| 387 return !!bubble_; | 387 return !!bubble_; |
| 388 } | 388 } |
| 389 | 389 |
| 390 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { | 390 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { |
| 391 HideImeMenuBubble(); | 391 HideImeMenuBubble(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 563 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
| 564 | 564 |
| 565 // Updates the tray label based on the current input method. | 565 // Updates the tray label based on the current input method. |
| 566 if (current_ime_.third_party) | 566 if (current_ime_.third_party) |
| 567 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 567 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
| 568 else | 568 else |
| 569 label_->SetText(current_ime_.short_name); | 569 label_->SetText(current_ime_.short_name); |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace ash | 572 } // namespace ash |
| OLD | NEW |