| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ime_menu/ime_list_view.h" | 5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.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/system/tray/hover_highlight_view.h" | 8 #include "ash/common/system/tray/hover_highlight_view.h" |
| 9 #include "ash/common/system/tray/ime_info.h" | 9 #include "ash/common/system/tray/ime_info.h" |
| 10 #include "ash/common/system/tray/system_menu_button.h" | 10 #include "ash/common/system/tray/system_menu_button.h" |
| 11 #include "ash/common/system/tray/system_menu_toggle_button.h" |
| 11 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 12 #include "ash/common/system/tray/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
| 13 #include "ash/common/system/tray/tray_details_view.h" | 14 #include "ash/common/system/tray/tray_details_view.h" |
| 14 #include "ash/common/system/tray/tray_popup_header_button.h" | 15 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 15 #include "ash/common/system/tray/tray_popup_item_style.h" | 16 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 16 #include "ash/common/system/tray/tray_popup_utils.h" | 17 #include "ash/common/system/tray/tray_popup_utils.h" |
| 17 #include "ash/common/system/tray/tri_view.h" | 18 #include "ash/common/system/tray/tri_view.h" |
| 18 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 19 #include "grit/ash_resources.h" | 20 #include "grit/ash_resources.h" |
| 20 #include "grit/ash_strings.h" | 21 #include "grit/ash_strings.h" |
| 21 #include "ui/accessibility/ax_node_data.h" | 22 #include "ui/accessibility/ax_node_data.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/gfx/color_palette.h" | 25 #include "ui/gfx/color_palette.h" |
| 25 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
| 26 #include "ui/gfx/vector_icons_public.h" | 27 #include "ui/gfx/vector_icons_public.h" |
| 27 #include "ui/keyboard/keyboard_util.h" | 28 #include "ui/keyboard/keyboard_util.h" |
| 28 #include "ui/views/background.h" | 29 #include "ui/views/background.h" |
| 29 #include "ui/views/border.h" | 30 #include "ui/views/border.h" |
| 30 #include "ui/views/controls/button/toggle_button.h" | |
| 31 #include "ui/views/controls/image_view.h" | 31 #include "ui/views/controls/image_view.h" |
| 32 #include "ui/views/controls/label.h" | 32 #include "ui/views/controls/label.h" |
| 33 #include "ui/views/controls/separator.h" | 33 #include "ui/views/controls/separator.h" |
| 34 #include "ui/views/layout/fill_layout.h" | 34 #include "ui/views/layout/fill_layout.h" |
| 35 #include "ui/views/painter.h" | 35 #include "ui/views/painter.h" |
| 36 #include "ui/views/view.h" | 36 #include "ui/views/view.h" |
| 37 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| 38 | 38 |
| 39 namespace ash { | 39 namespace ash { |
| 40 namespace { | 40 namespace { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 tri_view->AddView(TriView::Container::START, keyboard_image); | 215 tri_view->AddView(TriView::Container::START, keyboard_image); |
| 216 | 216 |
| 217 // The on-screen keyboard label. | 217 // The on-screen keyboard label. |
| 218 label_ = TrayPopupUtils::CreateDefaultLabel(); | 218 label_ = TrayPopupUtils::CreateDefaultLabel(); |
| 219 label_->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 219 label_->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 220 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD)); | 220 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD)); |
| 221 UpdateStyle(); | 221 UpdateStyle(); |
| 222 tri_view->AddView(TriView::Container::CENTER, label_); | 222 tri_view->AddView(TriView::Container::CENTER, label_); |
| 223 | 223 |
| 224 // The on-screen keyboard toggle button. | 224 // The on-screen keyboard toggle button. |
| 225 toggle_ = new views::ToggleButton(listener_); | 225 toggle_ = new SystemMenuToggleButton( |
| 226 toggle_->SetFocusForPlatform(); | 226 listener_, IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD); |
| 227 toggle_->SetAccessibleName( | |
| 228 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | |
| 229 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD)); | |
| 230 tri_view->AddView(TriView::Container::END, toggle_); | 227 tri_view->AddView(TriView::Container::END, toggle_); |
| 231 } | 228 } |
| 232 | 229 |
| 233 // Updates the style of |label_| based on the current native theme. | 230 // Updates the style of |label_| based on the current native theme. |
| 234 void UpdateStyle() { | 231 void UpdateStyle() { |
| 235 TrayPopupItemStyle style( | 232 TrayPopupItemStyle style( |
| 236 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); | 233 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); |
| 237 style.SetupLabel(label_); | 234 style.SetupLabel(label_); |
| 238 } | 235 } |
| 239 | 236 |
| 240 // ButtonListener to notify when |toggle_| is clicked. | 237 // ButtonListener to notify when |toggle_| is clicked. |
| 241 views::ButtonListener* listener_; | 238 views::ButtonListener* listener_; |
| 242 | 239 |
| 243 // Label to with text 'On-screen keyboard'. | 240 // Label to with text 'On-screen keyboard'. |
| 244 views::Label* label_; | 241 views::Label* label_; |
| 245 | 242 |
| 246 // ToggleButton to toggle keyboard on or off. | 243 // ToggleButton to toggle keyboard on or off. |
| 247 views::ToggleButton* toggle_; | 244 SystemMenuToggleButton* toggle_; |
| 248 | 245 |
| 249 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView); | 246 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView); |
| 250 }; | 247 }; |
| 251 | 248 |
| 252 ImeListView::ImeListView(SystemTrayItem* owner, | 249 ImeListView::ImeListView(SystemTrayItem* owner, |
| 253 bool show_keyboard_toggle, | 250 bool show_keyboard_toggle, |
| 254 SingleImeBehavior single_ime_behavior) | 251 SingleImeBehavior single_ime_behavior) |
| 255 : TrayDetailsView(owner) { | 252 : TrayDetailsView(owner) { |
| 256 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 253 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| 257 IMEInfoList list; | 254 IMEInfoList list; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 405 } |
| 409 | 406 |
| 410 void ImeListView::HandleButtonPressed(views::Button* sender, | 407 void ImeListView::HandleButtonPressed(views::Button* sender, |
| 411 const ui::Event& event) { | 408 const ui::Event& event) { |
| 412 DCHECK(material_keyboard_status_view_); | 409 DCHECK(material_keyboard_status_view_); |
| 413 DCHECK_EQ(sender, material_keyboard_status_view_->toggle()); | 410 DCHECK_EQ(sender, material_keyboard_status_view_->toggle()); |
| 414 WmShell::Get()->ToggleIgnoreExternalKeyboard(); | 411 WmShell::Get()->ToggleIgnoreExternalKeyboard(); |
| 415 } | 412 } |
| 416 | 413 |
| 417 } // namespace ash | 414 } // namespace ash |
| OLD | NEW |