| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (WmShell::HasInstance()) | 48 if (WmShell::HasInstance()) |
| 49 WmShell::Get()->keyboard_ui()->AddObserver(this); | 49 WmShell::Get()->keyboard_ui()->AddObserver(this); |
| 50 } | 50 } |
| 51 | 51 |
| 52 VirtualKeyboardTray::~VirtualKeyboardTray() { | 52 VirtualKeyboardTray::~VirtualKeyboardTray() { |
| 53 // The Shell may not exist in some unit tests. | 53 // The Shell may not exist in some unit tests. |
| 54 if (WmShell::HasInstance()) | 54 if (WmShell::HasInstance()) |
| 55 WmShell::Get()->keyboard_ui()->RemoveObserver(this); | 55 WmShell::Get()->keyboard_ui()->RemoveObserver(this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment) { | 58 void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment, |
| 59 TrayBackgroundView::SetShelfAlignment(alignment); | 59 const gfx::Insets& insets) { |
| 60 TrayBackgroundView::SetShelfAlignment(alignment, insets); |
| 60 tray_container()->SetBorder(views::Border::NullBorder()); | 61 tray_container()->SetBorder(views::Border::NullBorder()); |
| 61 | 62 |
| 62 // Pad button size to align with other controls in the system tray. | 63 // Pad button size to align with other controls in the system tray. |
| 63 const gfx::ImageSkia image = | 64 const gfx::ImageSkia image = |
| 64 button_->GetImage(views::CustomButton::STATE_NORMAL); | 65 button_->GetImage(views::CustomButton::STATE_NORMAL); |
| 65 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); | 66 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
| 66 const int vertical_padding = (size - image.height()) / 2; | 67 const int vertical_padding = (size - image.height()) / 2; |
| 67 int horizontal_padding = (size - image.width()) / 2; | 68 int horizontal_padding = (size - image.width()) / 2; |
| 68 if (!ash::MaterialDesignController::IsShelfMaterial() && | 69 if (!ash::MaterialDesignController::IsShelfMaterial() && |
| 69 IsHorizontalAlignment(alignment)) { | 70 IsHorizontalAlignment(alignment)) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 96 const ui::Event& event) { | 97 const ui::Event& event) { |
| 97 DCHECK_EQ(button_, sender); | 98 DCHECK_EQ(button_, sender); |
| 98 PerformAction(event); | 99 PerformAction(event); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { | 102 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { |
| 102 SetVisible(WmShell::Get()->keyboard_ui()->IsEnabled()); | 103 SetVisible(WmShell::Get()->keyboard_ui()->IsEnabled()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace ash | 106 } // namespace ash |
| OLD | NEW |