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

Unified Diff: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc

Issue 2445293002: Make the virtual keyboard show up on the display with input focus. (Closed)
Patch Set: fix one more compilation error on Windows Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc
diff --git a/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc b/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc
index 6bf5207c62fb406eff5b8af709c636069c4d5dcb..eb8826738c441acb9d26eb6cb7a607d410f066a3 100644
--- a/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc
+++ b/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc
@@ -9,14 +9,17 @@
#include "ash/common/keyboard/keyboard_ui.h"
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/shelf/shelf_constants.h"
+#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm_shell.h"
+#include "ash/common/wm_window.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/display/display.h"
#include "ui/events/event.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/paint_vector_icon.h"
@@ -27,7 +30,9 @@
namespace ash {
VirtualKeyboardTray::VirtualKeyboardTray(WmShelf* wm_shelf)
- : TrayBackgroundView(wm_shelf), icon_(new views::ImageView) {
+ : TrayBackgroundView(wm_shelf),
+ icon_(new views::ImageView),
+ wm_shelf_(wm_shelf) {
if (MaterialDesignController::IsShelfMaterial()) {
SetInkDropMode(InkDropMode::ON);
SetContentsBackground(false);
@@ -78,7 +83,9 @@ void VirtualKeyboardTray::HideBubbleWithView(
void VirtualKeyboardTray::ClickedOutsideBubble() {}
bool VirtualKeyboardTray::PerformAction(const ui::Event& event) {
- WmShell::Get()->keyboard_ui()->Show();
+ const int64_t display_id =
+ wm_shelf_->GetWindow()->GetDisplayNearestWindow().id();
+ WmShell::Get()->keyboard_ui()->ShowInDisplay(display_id);
// Normally, active status is set when virtual keyboard is shown/hidden,
// however, showing virtual keyboard happens asynchronously and, especially
// the first time, takes some time. We need to set active status here to

Powered by Google App Engine
This is Rietveld 408576698