Chromium Code Reviews| Index: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| diff --git a/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc b/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| index 74040a8a531ccd3ebc3bed7e690e72215bbf4b09..a102fa8a52a72cae222b8ba7538c6d47aee9ffcd 100644 |
| --- a/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| +++ b/ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc |
| @@ -7,19 +7,14 @@ |
| #include <algorithm> |
| #include "ash/common/keyboard/keyboard_ui.h" |
| -#include "ash/common/material_design/material_design_controller.h" |
| #include "ash/common/shelf/shelf_constants.h" |
| #include "ash/common/shelf/wm_shelf.h" |
| -#include "ash/common/shelf/wm_shelf_util.h" |
| #include "ash/common/system/tray/tray_constants.h" |
| -#include "ash/common/system/tray/tray_utils.h" |
| #include "ash/common/wm_shell.h" |
| #include "ash/common/wm_window.h" |
| -#include "ash/resources/grit/ash_resources.h" |
| #include "ash/resources/vector_icons/vector_icons.h" |
| #include "grit/ash_strings.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -#include "ui/base/resource/resource_bundle.h" |
| #include "ui/display/display.h" |
| #include "ui/events/event.h" |
| #include "ui/gfx/image/image_skia.h" |
| @@ -33,22 +28,13 @@ VirtualKeyboardTray::VirtualKeyboardTray(WmShelf* wm_shelf) |
| : TrayBackgroundView(wm_shelf), |
| icon_(new views::ImageView), |
| wm_shelf_(wm_shelf) { |
| - if (MaterialDesignController::IsShelfMaterial()) { |
| - SetInkDropMode(InkDropMode::ON); |
| - SetContentsBackground(false); |
| - gfx::ImageSkia image_md = |
| - CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor); |
| - icon_->SetImage(image_md); |
| - } else { |
| - SetContentsBackground(true); |
| - gfx::ImageSkia* image_non_md = |
| - ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| - IDR_AURA_UBER_TRAY_VIRTUAL_KEYBOARD); |
| - icon_->SetImage(image_non_md); |
| - } |
| + SetInkDropMode(InkDropMode::ON); |
| + SetContentsBackground(false); |
| + icon_->SetImage(CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor)); |
|
tdanderson
2017/02/22 21:52:54
nit: gfx::CreateVectorIcon
mohsen
2017/02/23 04:58:32
Done.
|
| SetIconBorderForShelfAlignment(); |
| tray_container()->AddChildView(icon_); |
| + |
| // The Shell may not exist in some unit tests. |
| if (WmShell::HasInstance()) |
| WmShell::Get()->keyboard_ui()->AddObserver(this); |
| @@ -115,21 +101,10 @@ void VirtualKeyboardTray::OnKeyboardBoundsChanging( |
| void VirtualKeyboardTray::OnKeyboardClosed() {} |
| void VirtualKeyboardTray::SetIconBorderForShelfAlignment() { |
|
tdanderson
2017/02/22 21:52:54
With this patch and your other patch https://chrom
mohsen
2017/02/23 04:58:32
Added comment to https://crbug.com/690992.
|
| - // Every time shelf alignment is updated, StatusAreaWidgetDelegate resets the |
| - // border to a non-null border. So, we need to remove it. |
| - if (!ash::MaterialDesignController::IsShelfMaterial()) |
| - tray_container()->SetBorder(views::NullBorder()); |
| const gfx::ImageSkia& image = icon_->GetImage(); |
| const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); |
|
tdanderson
2017/02/22 21:52:54
You can rip out VIRTUAL_KEYBOARD_BUTTON_SIZE entir
mohsen
2017/02/23 04:58:32
Done.
|
| const int vertical_padding = (size - image.height()) / 2; |
| - int horizontal_padding = (size - image.width()) / 2; |
| - if (!ash::MaterialDesignController::IsShelfMaterial() && |
| - IsHorizontalAlignment(shelf_alignment())) { |
| - // Square up the padding if horizontally aligned. Avoid extra padding when |
| - // vertically aligned as the button would violate the width constraint on |
| - // the shelf. |
| - horizontal_padding += std::max(0, vertical_padding - horizontal_padding); |
| - } |
| + const int horizontal_padding = (size - image.width()) / 2; |
| icon_->SetBorder(views::CreateEmptyBorder( |
| gfx::Insets(vertical_padding, horizontal_padding))); |
| } |