| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Every time shelf alignment is updated, StatusAreaWidgetDelegate resets the | 101 // Every time shelf alignment is updated, StatusAreaWidgetDelegate resets the |
| 102 // border to a non-null border. So, we need to remove it. | 102 // border to a non-null border. So, we need to remove it. |
| 103 tray_container()->SetBorder(views::Border::NullBorder()); | 103 if (!ash::MaterialDesignController::IsShelfMaterial()) |
| 104 | 104 tray_container()->SetBorder(views::Border::NullBorder()); |
| 105 const gfx::ImageSkia& image = icon_->GetImage(); | 105 const gfx::ImageSkia& image = icon_->GetImage(); |
| 106 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); | 106 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
| 107 const int vertical_padding = (size - image.height()) / 2; | 107 const int vertical_padding = (size - image.height()) / 2; |
| 108 int horizontal_padding = (size - image.width()) / 2; | 108 int horizontal_padding = (size - image.width()) / 2; |
| 109 if (!ash::MaterialDesignController::IsShelfMaterial() && | 109 if (!ash::MaterialDesignController::IsShelfMaterial() && |
| 110 IsHorizontalAlignment(shelf_alignment())) { | 110 IsHorizontalAlignment(shelf_alignment())) { |
| 111 // Square up the padding if horizontally aligned. Avoid extra padding when | 111 // Square up the padding if horizontally aligned. Avoid extra padding when |
| 112 // vertically aligned as the button would violate the width constraint on | 112 // vertically aligned as the button would violate the width constraint on |
| 113 // the shelf. | 113 // the shelf. |
| 114 horizontal_padding += std::max(0, vertical_padding - horizontal_padding); | 114 horizontal_padding += std::max(0, vertical_padding - horizontal_padding); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 void VirtualKeyboardTray::UnobserveKeyboardController() { | 127 void VirtualKeyboardTray::UnobserveKeyboardController() { |
| 128 keyboard::KeyboardController* keyboard_controller = | 128 keyboard::KeyboardController* keyboard_controller = |
| 129 keyboard::KeyboardController::GetInstance(); | 129 keyboard::KeyboardController::GetInstance(); |
| 130 if (keyboard_controller) | 130 if (keyboard_controller) |
| 131 keyboard_controller->RemoveObserver(this); | 131 keyboard_controller->RemoveObserver(this); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace ash | 134 } // namespace ash |
| OLD | NEW |