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" |
(...skipping 11 matching lines...) Expand all Loading... |
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), |
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); | 32 SetContentsBackground(); |
33 | 33 |
34 icon_->SetImage(gfx::CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor)); | 34 icon_->SetImage(gfx::CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor)); |
35 SetIconBorderForShelfAlignment(); | 35 SetIconBorderForShelfAlignment(); |
36 tray_container()->AddChildView(icon_); | 36 tray_container()->AddChildView(icon_); |
37 | 37 |
38 // The Shell may not exist in some unit tests. | 38 // The Shell may not exist in some unit tests. |
39 if (WmShell::HasInstance()) | 39 if (WmShell::HasInstance()) |
40 WmShell::Get()->keyboard_ui()->AddObserver(this); | 40 WmShell::Get()->keyboard_ui()->AddObserver(this); |
41 // Try observing keyboard controller, in case it is already constructed. | 41 // Try observing keyboard controller, in case it is already constructed. |
42 ObserveKeyboardController(); | 42 ObserveKeyboardController(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 void VirtualKeyboardTray::UnobserveKeyboardController() { | 118 void VirtualKeyboardTray::UnobserveKeyboardController() { |
119 keyboard::KeyboardController* keyboard_controller = | 119 keyboard::KeyboardController* keyboard_controller = |
120 keyboard::KeyboardController::GetInstance(); | 120 keyboard::KeyboardController::GetInstance(); |
121 if (keyboard_controller) | 121 if (keyboard_controller) |
122 keyboard_controller->RemoveObserver(this); | 122 keyboard_controller->RemoveObserver(this); |
123 } | 123 } |
124 | 124 |
125 } // namespace ash | 125 } // namespace ash |
OLD | NEW |