OLD | NEW |
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/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
9 #include "ash/common/shelf/wm_shelf_util.h" | 9 #include "ash/common/shelf/wm_shelf_util.h" |
10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 views::CustomButton::STATE_NORMAL); | 66 views::CustomButton::STATE_NORMAL); |
67 int top_padding = (kTrayBarButtonWidth - image.height()) / 2; | 67 int top_padding = (kTrayBarButtonWidth - image.height()) / 2; |
68 int left_padding = (kTrayBarButtonWidth - image.width()) / 2; | 68 int left_padding = (kTrayBarButtonWidth - image.width()) / 2; |
69 int bottom_padding = kTrayBarButtonWidth - image.height() - top_padding; | 69 int bottom_padding = kTrayBarButtonWidth - image.height() - top_padding; |
70 int right_padding = kTrayBarButtonWidth - image.width() - left_padding; | 70 int right_padding = kTrayBarButtonWidth - image.width() - left_padding; |
71 | 71 |
72 // Square up the padding if horizontally aligned. Avoid extra padding when | 72 // Square up the padding if horizontally aligned. Avoid extra padding when |
73 // vertically aligned as the button would violate the width constraint on the | 73 // vertically aligned as the button would violate the width constraint on the |
74 // shelf. | 74 // shelf. |
75 if (IsHorizontalAlignment(alignment)) { | 75 if (IsHorizontalAlignment(alignment)) { |
76 gfx::Insets insets = button_->GetInsets(); | |
77 int additional_padding = std::max(0, top_padding - left_padding); | 76 int additional_padding = std::max(0, top_padding - left_padding); |
78 left_padding += additional_padding; | 77 left_padding += additional_padding; |
79 right_padding += additional_padding; | 78 right_padding += additional_padding; |
80 } | 79 } |
81 | 80 |
82 button_->SetBorder(views::Border::CreateEmptyBorder( | 81 button_->SetBorder(views::Border::CreateEmptyBorder( |
83 top_padding, | 82 top_padding, |
84 left_padding, | 83 left_padding, |
85 bottom_padding, | 84 bottom_padding, |
86 right_padding)); | 85 right_padding)); |
(...skipping 19 matching lines...) Expand all Loading... |
106 const ui::Event& event) { | 105 const ui::Event& event) { |
107 DCHECK_EQ(button_, sender); | 106 DCHECK_EQ(button_, sender); |
108 PerformAction(event); | 107 PerformAction(event); |
109 } | 108 } |
110 | 109 |
111 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { | 110 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { |
112 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); | 111 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); |
113 } | 112 } |
114 | 113 |
115 } // namespace ash | 114 } // namespace ash |
OLD | NEW |