Chromium Code Reviews| 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" |
|
tdanderson
2016/11/12 02:18:58
nit: can you please include a CL description that
mohsen
2016/11/13 05:10:04
Done.
| |
| 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" | 14 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 15 #include "ash/common/system/tray/hover_highlight_view.h" | 15 #include "ash/common/system/tray/hover_highlight_view.h" |
| 16 #include "ash/common/system/tray/system_menu_button.h" | 16 #include "ash/common/system/tray/system_menu_button.h" |
| 17 #include "ash/common/system/tray/system_tray_controller.h" | 17 #include "ash/common/system/tray/system_tray_controller.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 } // namespace | 312 } // namespace |
| 313 | 313 |
| 314 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf) | 314 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf) |
| 315 : TrayBackgroundView(wm_shelf), | 315 : TrayBackgroundView(wm_shelf), |
| 316 label_(new ImeMenuLabel()), | 316 label_(new ImeMenuLabel()), |
| 317 show_keyboard_(false), | 317 show_keyboard_(false), |
| 318 force_show_keyboard_(false), | 318 force_show_keyboard_(false), |
| 319 should_block_shelf_auto_hide_(false) { | 319 should_block_shelf_auto_hide_(false) { |
| 320 SetupLabelForTray(label_); | 320 SetupLabelForTray(label_); |
| 321 tray_container()->AddChildView(label_); | 321 tray_container()->AddChildView(label_); |
| 322 SetContentsBackground(); | 322 SetContentsBackground(true); |
| 323 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this); | 323 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this); |
| 324 } | 324 } |
| 325 | 325 |
| 326 ImeMenuTray::~ImeMenuTray() { | 326 ImeMenuTray::~ImeMenuTray() { |
| 327 if (bubble_) | 327 if (bubble_) |
| 328 bubble_->bubble_view()->reset_delegate(); | 328 bubble_->bubble_view()->reset_delegate(); |
| 329 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this); | 329 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void ImeMenuTray::ShowImeMenuBubble() { | 332 void ImeMenuTray::ShowImeMenuBubble() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 new ImeButtonsView(this, true, true, true, true)); | 385 new ImeButtonsView(this, true, true, true, true)); |
| 386 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { | 386 } else if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| 387 // For MD, we don't need |ImeButtonsView| as the settings button will be | 387 // For MD, we don't need |ImeButtonsView| as the settings button will be |
| 388 // shown in the title row. | 388 // shown in the title row. |
| 389 bubble_view->AddChildView( | 389 bubble_view->AddChildView( |
| 390 new ImeButtonsView(this, false, false, false, true)); | 390 new ImeButtonsView(this, false, false, false, true)); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 bubble_.reset(new TrayBubbleWrapper(this, bubble_view)); | 394 bubble_.reset(new TrayBubbleWrapper(this, bubble_view)); |
| 395 SetDrawBackgroundAsActive(true); | 395 SetIsActive(true); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void ImeMenuTray::HideImeMenuBubble() { | 398 void ImeMenuTray::HideImeMenuBubble() { |
| 399 bubble_.reset(); | 399 bubble_.reset(); |
| 400 ime_list_view_ = nullptr; | 400 ime_list_view_ = nullptr; |
| 401 SetDrawBackgroundAsActive(false); | 401 SetIsActive(false); |
| 402 should_block_shelf_auto_hide_ = false; | 402 should_block_shelf_auto_hide_ = false; |
| 403 shelf()->UpdateAutoHideState(); | 403 shelf()->UpdateAutoHideState(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 bool ImeMenuTray::IsImeMenuBubbleShown() { | 406 bool ImeMenuTray::IsImeMenuBubbleShown() { |
| 407 return !!bubble_; | 407 return !!bubble_; |
| 408 } | 408 } |
| 409 | 409 |
| 410 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { | 410 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { |
| 411 HideImeMenuBubble(); | 411 HideImeMenuBubble(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 583 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
| 584 | 584 |
| 585 // Updates the tray label based on the current input method. | 585 // Updates the tray label based on the current input method. |
| 586 if (current_ime_.third_party) | 586 if (current_ime_.third_party) |
| 587 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 587 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
| 588 else | 588 else |
| 589 label_->SetText(current_ime_.short_name); | 589 label_->SetText(current_ime_.short_name); |
| 590 } | 590 } |
| 591 | 591 |
| 592 } // namespace ash | 592 } // namespace ash |
| OLD | NEW |