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

Side by Side Diff: ash/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: 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/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" 5 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h"
6 6
7 #include "ash/common/keyboard/keyboard_ui.h" 7 #include "ash/common/keyboard/keyboard_ui.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/shelf/shelf_constants.h" 9 #include "ash/common/shelf/shelf_constants.h"
10 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 if (Shell::HasInstance()) 46 if (Shell::HasInstance())
47 Shell::GetInstance()->keyboard_ui()->AddObserver(this); 47 Shell::GetInstance()->keyboard_ui()->AddObserver(this);
48 } 48 }
49 49
50 VirtualKeyboardTray::~VirtualKeyboardTray() { 50 VirtualKeyboardTray::~VirtualKeyboardTray() {
51 // The Shell may not exist in some unit tests. 51 // The Shell may not exist in some unit tests.
52 if (Shell::HasInstance()) 52 if (Shell::HasInstance())
53 Shell::GetInstance()->keyboard_ui()->RemoveObserver(this); 53 Shell::GetInstance()->keyboard_ui()->RemoveObserver(this);
54 } 54 }
55 55
56 void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment) { 56 void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment,
57 TrayBackgroundView::SetShelfAlignment(alignment); 57 const gfx::Insets& insets) {
58 TrayBackgroundView::SetShelfAlignment(alignment, insets);
58 tray_container()->SetBorder(views::Border::NullBorder()); 59 tray_container()->SetBorder(views::Border::NullBorder());
59 60
60 // Pad button size to align with other controls in the system tray. 61 // Pad button size to align with other controls in the system tray.
61 const gfx::ImageSkia image = 62 const gfx::ImageSkia image =
62 button_->GetImage(views::CustomButton::STATE_NORMAL); 63 button_->GetImage(views::CustomButton::STATE_NORMAL);
63 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE); 64 const int size = GetTrayConstant(VIRTUAL_KEYBOARD_BUTTON_SIZE);
64 const int vertical_padding = (size - image.height()) / 2; 65 const int vertical_padding = (size - image.height()) / 2;
65 int horizontal_padding = (size - image.width()) / 2; 66 int horizontal_padding = (size - image.width()) / 2;
66 if (!ash::MaterialDesignController::IsShelfMaterial() && 67 if (!ash::MaterialDesignController::IsShelfMaterial() &&
67 IsHorizontalAlignment(alignment)) { 68 IsHorizontalAlignment(alignment)) {
(...skipping 26 matching lines...) Expand all
94 const ui::Event& event) { 95 const ui::Event& event) {
95 DCHECK_EQ(button_, sender); 96 DCHECK_EQ(button_, sender);
96 PerformAction(event); 97 PerformAction(event);
97 } 98 }
98 99
99 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { 100 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) {
100 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); 101 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled());
101 } 102 }
102 103
103 } // namespace ash 104 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698