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

Side by Side Diff: ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc

Issue 2221283002: Fix VirtualKeyboardTray border (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a comment Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 UnobserveKeyboardController(); 91 UnobserveKeyboardController();
92 } 92 }
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
102 // border to a non-null border. So, we need to remove it.
103 tray_container()->SetBorder(views::Border::NullBorder());
104
101 const gfx::ImageSkia& image = icon_->GetImage(); 105 const gfx::ImageSkia& image = icon_->GetImage();
102 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); 106 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE);
103 const int vertical_padding = (size - image.height()) / 2; 107 const int vertical_padding = (size - image.height()) / 2;
104 int horizontal_padding = (size - image.width()) / 2; 108 int horizontal_padding = (size - image.width()) / 2;
105 if (!ash::MaterialDesignController::IsShelfMaterial() && 109 if (!ash::MaterialDesignController::IsShelfMaterial() &&
106 IsHorizontalAlignment(shelf_alignment())) { 110 IsHorizontalAlignment(shelf_alignment())) {
107 // Square up the padding if horizontally aligned. Avoid extra padding when 111 // Square up the padding if horizontally aligned. Avoid extra padding when
108 // vertically aligned as the button would violate the width constraint on 112 // vertically aligned as the button would violate the width constraint on
109 // the shelf. 113 // the shelf.
110 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
121 } 125 }
122 126
123 void VirtualKeyboardTray::UnobserveKeyboardController() { 127 void VirtualKeyboardTray::UnobserveKeyboardController() {
124 keyboard::KeyboardController* keyboard_controller = 128 keyboard::KeyboardController* keyboard_controller =
125 keyboard::KeyboardController::GetInstance(); 129 keyboard::KeyboardController::GetInstance();
126 if (keyboard_controller) 130 if (keyboard_controller)
127 keyboard_controller->RemoveObserver(this); 131 keyboard_controller->RemoveObserver(this);
128 } 132 }
129 133
130 } // namespace ash 134 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698