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

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

Issue 2897553002: Do not activate TrayBubbleView by default (Closed)
Patch Set: Remove unnecessary code. Created 3 years, 6 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/system/ime_menu/ime_menu_tray.h" 5 #include "ash/system/ime_menu/ime_menu_tray.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h"
7 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
8 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
9 #include "ash/ime/ime_controller.h" 10 #include "ash/ime/ime_controller.h"
10 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
11 #include "ash/session/session_controller.h" 12 #include "ash/session/session_controller.h"
12 #include "ash/shelf/shelf.h" 13 #include "ash/shelf/shelf.h"
13 #include "ash/shell.h" 14 #include "ash/shell.h"
14 #include "ash/shell_port.h" 15 #include "ash/shell_port.h"
15 #include "ash/strings/grit/ash_strings.h" 16 #include "ash/strings/grit/ash_strings.h"
16 #include "ash/system/ime_menu/ime_list_view.h" 17 #include "ash/system/ime_menu/ime_list_view.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 SetupLabelForTray(label_); 292 SetupLabelForTray(label_);
292 label_->SetElideBehavior(gfx::TRUNCATE); 293 label_->SetElideBehavior(gfx::TRUNCATE);
293 tray_container()->AddChildView(label_); 294 tray_container()->AddChildView(label_);
294 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); 295 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier();
295 tray_notifier->AddIMEObserver(this); 296 tray_notifier->AddIMEObserver(this);
296 tray_notifier->AddVirtualKeyboardObserver(this); 297 tray_notifier->AddVirtualKeyboardObserver(this);
297 } 298 }
298 299
299 ImeMenuTray::~ImeMenuTray() { 300 ImeMenuTray::~ImeMenuTray() {
300 if (bubble_) 301 if (bubble_)
301 bubble_->bubble_view()->reset_delegate(); 302 bubble_->bubble_view()->ResetDelegate();
302 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); 303 SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier();
303 tray_notifier->RemoveIMEObserver(this); 304 tray_notifier->RemoveIMEObserver(this);
304 tray_notifier->RemoveVirtualKeyboardObserver(this); 305 tray_notifier->RemoveVirtualKeyboardObserver(this);
305 keyboard::KeyboardController* keyboard_controller = 306 keyboard::KeyboardController* keyboard_controller =
306 keyboard::KeyboardController::GetInstance(); 307 keyboard::KeyboardController::GetInstance();
307 if (keyboard_controller) 308 if (keyboard_controller)
308 keyboard_controller->RemoveObserver(this); 309 keyboard_controller->RemoveObserver(this);
309 } 310 }
310 311
311 void ImeMenuTray::ShowImeMenuBubble() { 312 void ImeMenuTray::ShowImeMenuBubble() {
(...skipping 10 matching lines...) Expand all
322 } 323 }
323 324
324 void ImeMenuTray::ShowImeMenuBubbleInternal() { 325 void ImeMenuTray::ShowImeMenuBubbleInternal() {
325 views::TrayBubbleView::InitParams init_params; 326 views::TrayBubbleView::InitParams init_params;
326 init_params.delegate = this; 327 init_params.delegate = this;
327 init_params.parent_window = GetBubbleWindowContainer(); 328 init_params.parent_window = GetBubbleWindowContainer();
328 init_params.anchor_view = GetBubbleAnchor(); 329 init_params.anchor_view = GetBubbleAnchor();
329 init_params.anchor_alignment = GetAnchorAlignment(); 330 init_params.anchor_alignment = GetAnchorAlignment();
330 init_params.min_width = kTrayMenuMinimumWidth; 331 init_params.min_width = kTrayMenuMinimumWidth;
331 init_params.max_width = kTrayMenuMinimumWidth; 332 init_params.max_width = kTrayMenuMinimumWidth;
332 init_params.can_activate = true;
333 init_params.close_on_deactivate = true; 333 init_params.close_on_deactivate = true;
334 334
335 views::TrayBubbleView* bubble_view = new views::TrayBubbleView(init_params); 335 views::TrayBubbleView* bubble_view = new views::TrayBubbleView(init_params);
336 bubble_view->set_anchor_view_insets(GetBubbleAnchorInsets()); 336 bubble_view->set_anchor_view_insets(GetBubbleAnchorInsets());
337 337
338 // Add a title item with a separator on the top of the IME menu. 338 // Add a title item with a separator on the top of the IME menu.
339 bubble_view->AddChildView( 339 bubble_view->AddChildView(
340 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons())); 340 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons()));
341 341
342 // Adds IME list to the bubble. 342 // Adds IME list to the bubble.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 HideImeMenuBubble(); 461 HideImeMenuBubble();
462 } 462 }
463 463
464 void ImeMenuTray::BubbleViewDestroyed() { 464 void ImeMenuTray::BubbleViewDestroyed() {
465 } 465 }
466 466
467 void ImeMenuTray::OnMouseEnteredView() {} 467 void ImeMenuTray::OnMouseEnteredView() {}
468 468
469 void ImeMenuTray::OnMouseExitedView() {} 469 void ImeMenuTray::OnMouseExitedView() {}
470 470
471 void ImeMenuTray::RegisterAccelerators(
472 const std::vector<ui::Accelerator>& accelerators,
473 views::TrayBubbleView* tray_bubble_view) {
474 Shell::Get()->accelerator_controller()->Register(accelerators,
475 tray_bubble_view);
476 }
477
478 void ImeMenuTray::UnregisterAllAccelerators(
479 views::TrayBubbleView* tray_bubble_view) {
480 Shell::Get()->accelerator_controller()->UnregisterAll(tray_bubble_view);
481 }
482
471 base::string16 ImeMenuTray::GetAccessibleNameForBubble() { 483 base::string16 ImeMenuTray::GetAccessibleNameForBubble() {
472 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME); 484 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME);
473 } 485 }
474 486
487 bool ImeMenuTray::ShouldEnableExtraKeyboardAccessibility() {
488 return Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
489 }
490
475 void ImeMenuTray::HideBubble(const views::TrayBubbleView* bubble_view) { 491 void ImeMenuTray::HideBubble(const views::TrayBubbleView* bubble_view) {
476 HideBubbleWithView(bubble_view); 492 HideBubbleWithView(bubble_view);
477 } 493 }
478 494
479 void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {} 495 void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {}
480 496
481 void ImeMenuTray::OnKeyboardClosed() { 497 void ImeMenuTray::OnKeyboardClosed() {
482 if (InputMethodManager::Get()) 498 if (InputMethodManager::Get())
483 InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string()); 499 InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string());
484 keyboard::KeyboardController* keyboard_controller = 500 keyboard::KeyboardController* keyboard_controller =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 else 558 else
543 label_->SetText(current_ime_.short_name); 559 label_->SetText(current_ime_.short_name);
544 } 560 }
545 561
546 void ImeMenuTray::DisableVirtualKeyboard() { 562 void ImeMenuTray::DisableVirtualKeyboard() {
547 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); 563 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false);
548 force_show_keyboard_ = false; 564 force_show_keyboard_ = false;
549 } 565 }
550 566
551 } // namespace ash 567 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698