Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc

Issue 2712733003: Remove non-MD code from VirtualKeyboardTray (Closed)
Patch Set: Addressed review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/common/system/tray/tray_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..539367993bf3a603b5901063bbcc9879a44bdda6 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(gfx::CreateVectorIcon(kShelfKeyboardIcon, kShelfIconColor));
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,9 @@ void VirtualKeyboardTray::OnKeyboardBoundsChanging(
void VirtualKeyboardTray::OnKeyboardClosed() {}
void VirtualKeyboardTray::SetIconBorderForShelfAlignment() {
- // 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);
- 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 vertical_padding = (kTrayItemSize - image.height()) / 2;
+ const int horizontal_padding = (kTrayItemSize - image.width()) / 2;
icon_->SetBorder(views::CreateEmptyBorder(
gfx::Insets(vertical_padding, horizontal_padding)));
}
« no previous file with comments | « no previous file | ash/common/system/tray/tray_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698