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/keyboard/keyboard_ui.h" | 7 #include "ash/keyboard/keyboard_ui.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 if (Shell::HasInstance()) | 39 if (Shell::HasInstance()) |
40 Shell::GetInstance()->keyboard_ui()->AddObserver(this); | 40 Shell::GetInstance()->keyboard_ui()->AddObserver(this); |
41 } | 41 } |
42 | 42 |
43 VirtualKeyboardTray::~VirtualKeyboardTray() { | 43 VirtualKeyboardTray::~VirtualKeyboardTray() { |
44 // The Shell may not exist in some unit tests. | 44 // The Shell may not exist in some unit tests. |
45 if (Shell::HasInstance()) | 45 if (Shell::HasInstance()) |
46 Shell::GetInstance()->keyboard_ui()->RemoveObserver(this); | 46 Shell::GetInstance()->keyboard_ui()->RemoveObserver(this); |
47 } | 47 } |
48 | 48 |
49 void VirtualKeyboardTray::SetShelfAlignment(ShelfAlignment alignment) { | 49 void VirtualKeyboardTray::SetShelfAlignment(wm::ShelfAlignment alignment) { |
50 TrayBackgroundView::SetShelfAlignment(alignment); | 50 TrayBackgroundView::SetShelfAlignment(alignment); |
51 tray_container()->SetBorder(views::Border::NullBorder()); | 51 tray_container()->SetBorder(views::Border::NullBorder()); |
52 | 52 |
53 // Pad button size to align with other controls in the system tray. | 53 // Pad button size to align with other controls in the system tray. |
54 const gfx::ImageSkia image = button_->GetImage( | 54 const gfx::ImageSkia image = button_->GetImage( |
55 views::CustomButton::STATE_NORMAL); | 55 views::CustomButton::STATE_NORMAL); |
56 int top_padding = (kTrayBarButtonWidth - image.height()) / 2; | 56 int top_padding = (kTrayBarButtonWidth - image.height()) / 2; |
57 int left_padding = (kTrayBarButtonWidth - image.width()) / 2; | 57 int left_padding = (kTrayBarButtonWidth - image.width()) / 2; |
58 int bottom_padding = kTrayBarButtonWidth - image.height() - top_padding; | 58 int bottom_padding = kTrayBarButtonWidth - image.height() - top_padding; |
59 int right_padding = kTrayBarButtonWidth - image.width() - left_padding; | 59 int right_padding = kTrayBarButtonWidth - image.width() - left_padding; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 const ui::Event& event) { | 97 const ui::Event& event) { |
98 DCHECK_EQ(button_, sender); | 98 DCHECK_EQ(button_, sender); |
99 PerformAction(event); | 99 PerformAction(event); |
100 } | 100 } |
101 | 101 |
102 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { | 102 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { |
103 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); | 103 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); |
104 } | 104 } |
105 | 105 |
106 } // namespace ash | 106 } // namespace ash |
OLD | NEW |