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

Side by Side Diff: ash/system/virtual_keyboard/virtual_keyboard_tray.cc

Issue 2907853002: [mus+ash] Removes WmWindow from ash/shelf and ash/shell (Closed)
Patch Set: [mus+ash] Removes WmWindow from ash/shelf and ash/shell (removed some more wm_window.h) 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/virtual_keyboard/virtual_keyboard_tray.h" 5 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/keyboard/keyboard_ui.h" 9 #include "ash/keyboard/keyboard_ui.h"
10 #include "ash/resources/vector_icons/vector_icons.h" 10 #include "ash/resources/vector_icons/vector_icons.h"
11 #include "ash/shelf/shelf.h" 11 #include "ash/shelf/shelf.h"
12 #include "ash/shelf/shelf_constants.h" 12 #include "ash/shelf/shelf_constants.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/strings/grit/ash_strings.h" 14 #include "ash/strings/grit/ash_strings.h"
15 #include "ash/system/tray/tray_constants.h" 15 #include "ash/system/tray/tray_constants.h"
16 #include "ash/system/tray/tray_container.h" 16 #include "ash/system/tray/tray_container.h"
17 #include "ash/wm_window.h"
18 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/display/display.h" 18 #include "ui/display/display.h"
19 #include "ui/display/screen.h"
20 #include "ui/events/event.h" 20 #include "ui/events/event.h"
21 #include "ui/gfx/image/image_skia.h" 21 #include "ui/gfx/image/image_skia.h"
22 #include "ui/gfx/paint_vector_icon.h" 22 #include "ui/gfx/paint_vector_icon.h"
23 #include "ui/keyboard/keyboard_controller.h" 23 #include "ui/keyboard/keyboard_controller.h"
24 #include "ui/views/controls/image_view.h" 24 #include "ui/views/controls/image_view.h"
25 25
26 namespace ash { 26 namespace ash {
27 27
28 VirtualKeyboardTray::VirtualKeyboardTray(Shelf* shelf) 28 VirtualKeyboardTray::VirtualKeyboardTray(Shelf* shelf)
29 : TrayBackgroundView(shelf), icon_(new views::ImageView), shelf_(shelf) { 29 : TrayBackgroundView(shelf), icon_(new views::ImageView), shelf_(shelf) {
(...skipping 27 matching lines...) Expand all
57 return l10n_util::GetStringUTF16( 57 return l10n_util::GetStringUTF16(
58 IDS_ASH_VIRTUAL_KEYBOARD_TRAY_ACCESSIBLE_NAME); 58 IDS_ASH_VIRTUAL_KEYBOARD_TRAY_ACCESSIBLE_NAME);
59 } 59 }
60 60
61 void VirtualKeyboardTray::HideBubbleWithView( 61 void VirtualKeyboardTray::HideBubbleWithView(
62 const views::TrayBubbleView* bubble_view) {} 62 const views::TrayBubbleView* bubble_view) {}
63 63
64 void VirtualKeyboardTray::ClickedOutsideBubble() {} 64 void VirtualKeyboardTray::ClickedOutsideBubble() {}
65 65
66 bool VirtualKeyboardTray::PerformAction(const ui::Event& event) { 66 bool VirtualKeyboardTray::PerformAction(const ui::Event& event) {
67 const int64_t display_id = 67 const int64_t display_id = display::Screen::GetScreen()
68 shelf_->GetWindow()->GetDisplayNearestWindow().id(); 68 ->GetDisplayNearestWindow(shelf_->GetWindow())
69 .id();
69 Shell::Get()->keyboard_ui()->ShowInDisplay(display_id); 70 Shell::Get()->keyboard_ui()->ShowInDisplay(display_id);
70 // Normally, active status is set when virtual keyboard is shown/hidden, 71 // Normally, active status is set when virtual keyboard is shown/hidden,
71 // however, showing virtual keyboard happens asynchronously and, especially 72 // however, showing virtual keyboard happens asynchronously and, especially
72 // the first time, takes some time. We need to set active status here to 73 // the first time, takes some time. We need to set active status here to
73 // prevent bad things happening if user clicked the button before keyboard is 74 // prevent bad things happening if user clicked the button before keyboard is
74 // shown. 75 // shown.
75 SetIsActive(true); 76 SetIsActive(true);
76 return true; 77 return true;
77 } 78 }
78 79
(...skipping 24 matching lines...) Expand all
103 } 104 }
104 105
105 void VirtualKeyboardTray::UnobserveKeyboardController() { 106 void VirtualKeyboardTray::UnobserveKeyboardController() {
106 keyboard::KeyboardController* keyboard_controller = 107 keyboard::KeyboardController* keyboard_controller =
107 keyboard::KeyboardController::GetInstance(); 108 keyboard::KeyboardController::GetInstance();
108 if (keyboard_controller) 109 if (keyboard_controller)
109 keyboard_controller->RemoveObserver(this); 110 keyboard_controller->RemoveObserver(this);
110 } 111 }
111 112
112 } // namespace ash 113 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/toast/toast_manager_unittest.cc ('k') | ash/system/web_notification/ash_popup_alignment_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698