OLD | NEW |
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/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 5 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/common/keyboard/keyboard_ui.h" | 9 #include "ash/common/keyboard/keyboard_ui.h" |
10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
12 #include "ash/common/strings/grit/ash_strings.h" | 12 #include "ash/common/strings/grit/ash_strings.h" |
13 #include "ash/common/system/tray/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
15 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
16 #include "ash/resources/vector_icons/vector_icons.h" | 16 #include "ash/resources/vector_icons/vector_icons.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
19 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
20 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
21 #include "ui/gfx/paint_vector_icon.h" | 21 #include "ui/gfx/paint_vector_icon.h" |
22 #include "ui/keyboard/keyboard_controller.h" | 22 #include "ui/keyboard/keyboard_controller.h" |
23 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 | 26 |
27 VirtualKeyboardTray::VirtualKeyboardTray(WmShelf* wm_shelf) | 27 VirtualKeyboardTray::VirtualKeyboardTray(WmShelf* wm_shelf) |
28 : TrayBackgroundView(wm_shelf), | 28 : TrayBackgroundView(wm_shelf, true), |
29 icon_(new views::ImageView), | 29 icon_(new views::ImageView), |
30 wm_shelf_(wm_shelf) { | 30 wm_shelf_(wm_shelf) { |
31 SetInkDropMode(InkDropMode::ON); | 31 SetInkDropMode(InkDropMode::ON); |
32 SetContentsBackground(false); | |
33 | 32 |
34 icon_->SetImage(gfx::CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor)); | 33 icon_->SetImage(gfx::CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor)); |
35 SetIconBorderForShelfAlignment(); | 34 SetIconBorderForShelfAlignment(); |
36 tray_container()->AddChildView(icon_); | 35 tray_container()->AddChildView(icon_); |
37 | 36 |
38 // The Shell may not exist in some unit tests. | 37 // The Shell may not exist in some unit tests. |
39 if (WmShell::HasInstance()) | 38 if (WmShell::HasInstance()) |
40 WmShell::Get()->keyboard_ui()->AddObserver(this); | 39 WmShell::Get()->keyboard_ui()->AddObserver(this); |
41 // Try observing keyboard controller, in case it is already constructed. | 40 // Try observing keyboard controller, in case it is already constructed. |
42 ObserveKeyboardController(); | 41 ObserveKeyboardController(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 115 } |
117 | 116 |
118 void VirtualKeyboardTray::UnobserveKeyboardController() { | 117 void VirtualKeyboardTray::UnobserveKeyboardController() { |
119 keyboard::KeyboardController* keyboard_controller = | 118 keyboard::KeyboardController* keyboard_controller = |
120 keyboard::KeyboardController::GetInstance(); | 119 keyboard::KeyboardController::GetInstance(); |
121 if (keyboard_controller) | 120 if (keyboard_controller) |
122 keyboard_controller->RemoveObserver(this); | 121 keyboard_controller->RemoveObserver(this); |
123 } | 122 } |
124 | 123 |
125 } // namespace ash | 124 } // namespace ash |
OLD | NEW |