Chromium Code Reviews| 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/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 UnobserveKeyboardController(); | 91 UnobserveKeyboardController(); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 void VirtualKeyboardTray::OnKeyboardBoundsChanging( | 95 void VirtualKeyboardTray::OnKeyboardBoundsChanging( |
| 96 const gfx::Rect& new_bounds) { | 96 const gfx::Rect& new_bounds) { |
| 97 SetDrawBackgroundAsActive(!new_bounds.IsEmpty()); | 97 SetDrawBackgroundAsActive(!new_bounds.IsEmpty()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void VirtualKeyboardTray::SetIconBorderForShelfAlignment() { | 100 void VirtualKeyboardTray::SetIconBorderForShelfAlignment() { |
| 101 tray_container()->SetBorder(views::Border::NullBorder()); | |
|
James Cook
2016/08/09 15:54:32
Why does this have to be done every time the shelf
mohsen
2016/08/09 16:32:51
After each shelf alignment change, the border is r
| |
| 102 | |
| 101 const gfx::ImageSkia& image = icon_->GetImage(); | 103 const gfx::ImageSkia& image = icon_->GetImage(); |
| 102 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); | 104 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
| 103 const int vertical_padding = (size - image.height()) / 2; | 105 const int vertical_padding = (size - image.height()) / 2; |
| 104 int horizontal_padding = (size - image.width()) / 2; | 106 int horizontal_padding = (size - image.width()) / 2; |
| 105 if (!ash::MaterialDesignController::IsShelfMaterial() && | 107 if (!ash::MaterialDesignController::IsShelfMaterial() && |
| 106 IsHorizontalAlignment(shelf_alignment())) { | 108 IsHorizontalAlignment(shelf_alignment())) { |
| 107 // Square up the padding if horizontally aligned. Avoid extra padding when | 109 // Square up the padding if horizontally aligned. Avoid extra padding when |
| 108 // vertically aligned as the button would violate the width constraint on | 110 // vertically aligned as the button would violate the width constraint on |
| 109 // the shelf. | 111 // the shelf. |
| 110 horizontal_padding += std::max(0, vertical_padding - horizontal_padding); | 112 horizontal_padding += std::max(0, vertical_padding - horizontal_padding); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 121 } | 123 } |
| 122 | 124 |
| 123 void VirtualKeyboardTray::UnobserveKeyboardController() { | 125 void VirtualKeyboardTray::UnobserveKeyboardController() { |
| 124 keyboard::KeyboardController* keyboard_controller = | 126 keyboard::KeyboardController* keyboard_controller = |
| 125 keyboard::KeyboardController::GetInstance(); | 127 keyboard::KeyboardController::GetInstance(); |
| 126 if (keyboard_controller) | 128 if (keyboard_controller) |
| 127 keyboard_controller->RemoveObserver(this); | 129 keyboard_controller->RemoveObserver(this); |
| 128 } | 130 } |
| 129 | 131 |
| 130 } // namespace ash | 132 } // namespace ash |
| OLD | NEW |