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

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

Issue 2901273003: chromeos: Remove TrayBubbleView::Delegate::OnBeforeBubbleWidgetInit (Closed)
Patch Set: nit 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
« no previous file with comments | « ash/system/ime_menu/ime_menu_tray.h ('k') | ash/system/palette/palette_tray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/ash_constants.h" 8 #include "ash/ash_constants.h"
9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/resources/grit/ash_resources.h" 9 #include "ash/resources/grit/ash_resources.h"
11 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
12 #include "ash/session/session_controller.h" 11 #include "ash/session/session_controller.h"
13 #include "ash/shelf/shelf.h" 12 #include "ash/shelf/shelf.h"
14 #include "ash/shell.h" 13 #include "ash/shell.h"
15 #include "ash/shell_port.h" 14 #include "ash/shell_port.h"
16 #include "ash/strings/grit/ash_strings.h" 15 #include "ash/strings/grit/ash_strings.h"
17 #include "ash/system/ime_menu/ime_list_view.h" 16 #include "ash/system/ime_menu/ime_list_view.h"
18 #include "ash/system/tray/system_menu_button.h" 17 #include "ash/system/tray/system_menu_button.h"
19 #include "ash/system/tray/system_tray_controller.h" 18 #include "ash/system/tray/system_tray_controller.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 show_bubble_after_keyboard_hidden_ = true; 315 show_bubble_after_keyboard_hidden_ = true;
317 keyboard_controller->AddObserver(this); 316 keyboard_controller->AddObserver(this);
318 keyboard_controller->HideKeyboard( 317 keyboard_controller->HideKeyboard(
319 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); 318 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
320 } else { 319 } else {
321 ShowImeMenuBubbleInternal(); 320 ShowImeMenuBubbleInternal();
322 } 321 }
323 } 322 }
324 323
325 void ImeMenuTray::ShowImeMenuBubbleInternal() { 324 void ImeMenuTray::ShowImeMenuBubbleInternal() {
326 views::TrayBubbleView::InitParams init_params( 325 views::TrayBubbleView::InitParams init_params;
327 GetAnchorAlignment(), kTrayMenuMinimumWidth, kTrayMenuMinimumWidth); 326 init_params.delegate = this;
327 init_params.parent_window = GetBubbleWindowContainer();
328 init_params.anchor_view = GetBubbleAnchor();
329 init_params.anchor_alignment = GetAnchorAlignment();
330 init_params.min_width = kTrayMenuMinimumWidth;
331 init_params.max_width = kTrayMenuMinimumWidth;
328 init_params.can_activate = true; 332 init_params.can_activate = true;
329 init_params.close_on_deactivate = true; 333 init_params.close_on_deactivate = true;
330 334
331 views::TrayBubbleView* bubble_view = 335 views::TrayBubbleView* bubble_view = new views::TrayBubbleView(init_params);
332 views::TrayBubbleView::Create(GetBubbleAnchor(), this, &init_params);
333 bubble_view->set_anchor_view_insets(GetBubbleAnchorInsets()); 336 bubble_view->set_anchor_view_insets(GetBubbleAnchorInsets());
334 337
335 // 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.
336 bubble_view->AddChildView( 339 bubble_view->AddChildView(
337 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons())); 340 new ImeTitleView(!ShouldShowEmojiHandwritingVoiceButtons()));
338 341
339 // Adds IME list to the bubble. 342 // Adds IME list to the bubble.
340 ime_list_view_ = new ImeMenuListView(nullptr); 343 ime_list_view_ = new ImeMenuListView(nullptr);
341 ime_list_view_->Init(ShouldShowKeyboardToggle(), 344 ime_list_view_->Init(ShouldShowKeyboardToggle(),
342 ImeListView::SHOW_SINGLE_IME); 345 ImeListView::SHOW_SINGLE_IME);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 467 }
465 468
466 void ImeMenuTray::OnMouseEnteredView() {} 469 void ImeMenuTray::OnMouseEnteredView() {}
467 470
468 void ImeMenuTray::OnMouseExitedView() {} 471 void ImeMenuTray::OnMouseExitedView() {}
469 472
470 base::string16 ImeMenuTray::GetAccessibleNameForBubble() { 473 base::string16 ImeMenuTray::GetAccessibleNameForBubble() {
471 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME); 474 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME);
472 } 475 }
473 476
474 void ImeMenuTray::OnBeforeBubbleWidgetInit(
475 views::Widget* anchor_widget,
476 views::Widget* bubble_widget,
477 views::Widget::InitParams* params) const {
478 // Place the bubble in the same root window as |anchor_widget|.
479 RootWindowController::ForWindow(anchor_widget->GetNativeWindow())
480 ->ConfigureWidgetInitParamsForContainer(
481 bubble_widget, kShellWindowId_SettingBubbleContainer, params);
482 }
483
484 void ImeMenuTray::HideBubble(const views::TrayBubbleView* bubble_view) { 477 void ImeMenuTray::HideBubble(const views::TrayBubbleView* bubble_view) {
485 HideBubbleWithView(bubble_view); 478 HideBubbleWithView(bubble_view);
486 } 479 }
487 480
488 void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {} 481 void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {}
489 482
490 void ImeMenuTray::OnKeyboardClosed() { 483 void ImeMenuTray::OnKeyboardClosed() {
491 if (InputMethodManager::Get()) 484 if (InputMethodManager::Get())
492 InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string()); 485 InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string());
493 keyboard::KeyboardController* keyboard_controller = 486 keyboard::KeyboardController* keyboard_controller =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 else 544 else
552 label_->SetText(current_ime_.short_name); 545 label_->SetText(current_ime_.short_name);
553 } 546 }
554 547
555 void ImeMenuTray::DisableVirtualKeyboard() { 548 void ImeMenuTray::DisableVirtualKeyboard() {
556 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); 549 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false);
557 force_show_keyboard_ = false; 550 force_show_keyboard_ = false;
558 } 551 }
559 552
560 } // namespace ash 553 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/ime_menu/ime_menu_tray.h ('k') | ash/system/palette/palette_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698