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/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 5 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf.h" | |
| 7 #include "ash/shelf/shelf_constants.h" | 8 #include "ash/shelf/shelf_constants.h" |
| 8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 9 #include "ash/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | 11 #include "ash/system/tray/system_tray_notifier.h" |
| 11 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
| 12 #include "ash/system/tray/tray_utils.h" | 13 #include "ash/system/tray/tray_utils.h" |
| 13 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
| 14 #include "grit/ash_strings.h" | 15 #include "grit/ash_strings.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 37 VirtualKeyboardButton::VirtualKeyboardButton(views::ButtonListener* listener) | 38 VirtualKeyboardButton::VirtualKeyboardButton(views::ButtonListener* listener) |
| 38 : views::ImageButton(listener) { | 39 : views::ImageButton(listener) { |
| 39 } | 40 } |
| 40 | 41 |
| 41 VirtualKeyboardButton::~VirtualKeyboardButton() { | 42 VirtualKeyboardButton::~VirtualKeyboardButton() { |
| 42 } | 43 } |
| 43 | 44 |
| 44 gfx::Size VirtualKeyboardButton::GetPreferredSize() const { | 45 gfx::Size VirtualKeyboardButton::GetPreferredSize() const { |
| 45 const int virtual_keyboard_button_height = kShelfSize; | 46 const int virtual_keyboard_button_height = kShelfSize; |
| 46 gfx::Size size = ImageButton::GetPreferredSize(); | 47 gfx::Size size = ImageButton::GetPreferredSize(); |
| 47 int padding = virtual_keyboard_button_height - size.height(); | 48 Shelf *shelf = Shelf::ForPrimaryDisplay(); |
|
sadrul
2014/07/31 21:18:52
Shelf* shelf = ...
kevers
2014/08/01 15:21:40
Done.
| |
| 49 bool isHorizontal = shelf && (shelf->alignment() == SHELF_ALIGNMENT_BOTTOM || | |
|
sadrul
2014/07/31 21:18:52
is_horizontal
kevers
2014/08/01 15:21:40
Done.
| |
| 50 shelf->alignment() == SHELF_ALIGNMENT_TOP); | |
| 51 int padding = isHorizontal ? virtual_keyboard_button_height - size.height() : | |
| 52 0; | |
| 48 size.set_height(virtual_keyboard_button_height); | 53 size.set_height(virtual_keyboard_button_height); |
| 49 size.set_width(size.width() + padding); | 54 size.set_width(size.width() + padding); |
|
sadrul
2014/07/31 21:18:52
Why do we add this padding?
kevers
2014/08/01 15:21:40
The a11y button is detached form the remaining con
| |
| 50 return size; | 55 return size; |
| 51 } | 56 } |
| 52 | 57 |
| 53 } // namespace | 58 } // namespace |
| 54 | 59 |
| 55 VirtualKeyboardTray::VirtualKeyboardTray(StatusAreaWidget* status_area_widget) | 60 VirtualKeyboardTray::VirtualKeyboardTray(StatusAreaWidget* status_area_widget) |
| 56 : TrayBackgroundView(status_area_widget), | 61 : TrayBackgroundView(status_area_widget), |
| 57 button_(NULL) { | 62 button_(NULL) { |
| 58 button_ = new VirtualKeyboardButton(this); | 63 button_ = new VirtualKeyboardButton(this); |
| 59 button_->SetImage(views::CustomButton::STATE_NORMAL, | 64 button_->SetImage(views::CustomButton::STATE_NORMAL, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 PerformAction(event); | 113 PerformAction(event); |
| 109 } | 114 } |
| 110 | 115 |
| 111 void VirtualKeyboardTray::OnAccessibilityModeChanged( | 116 void VirtualKeyboardTray::OnAccessibilityModeChanged( |
| 112 AccessibilityNotificationVisibility notify) { | 117 AccessibilityNotificationVisibility notify) { |
| 113 SetVisible(Shell::GetInstance()->accessibility_delegate()-> | 118 SetVisible(Shell::GetInstance()->accessibility_delegate()-> |
| 114 IsVirtualKeyboardEnabled()); | 119 IsVirtualKeyboardEnabled()); |
| 115 } | 120 } |
| 116 | 121 |
| 117 } // namespace ash | 122 } // namespace ash |
| OLD | NEW |