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

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

Issue 2103113003: Fix shelf layout when switching from left-aligned shelf to right-aligned shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 5 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698