| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tray_accessibility.h" | 5 #include "ash/common/system/tray_accessibility.h" |
| 6 | 6 |
| 7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
| 8 #include "ash/common/accessibility_types.h" | 8 #include "ash/common/accessibility_types.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/system/tray/hover_highlight_view.h" | 11 #include "ash/common/system/tray/hover_highlight_view.h" |
| 12 #include "ash/common/system/tray/system_tray.h" | 12 #include "ash/common/system/tray/system_tray.h" |
| 13 #include "ash/common/system/tray/system_tray_controller.h" | 13 #include "ash/common/system/tray/system_tray_controller.h" |
| 14 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
| 15 #include "ash/common/system/tray/system_tray_notifier.h" | 15 #include "ash/common/system/tray/system_tray_notifier.h" |
| 16 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
| 17 #include "ash/common/system/tray/tray_details_view.h" | 17 #include "ash/common/system/tray/tray_details_view.h" |
| 18 #include "ash/common/system/tray/tray_item_more.h" | 18 #include "ash/common/system/tray/tray_item_more.h" |
| 19 #include "ash/common/system/tray/tray_popup_item_style.h" | 19 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 20 #include "ash/common/system/tray/tray_popup_label_button.h" | |
| 21 #include "ash/common/system/tray/tray_popup_utils.h" | 20 #include "ash/common/system/tray/tray_popup_utils.h" |
| 22 #include "ash/common/system/tray/tri_view.h" | 21 #include "ash/common/system/tray/tri_view.h" |
| 23 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
| 24 #include "ash/resources/vector_icons/vector_icons.h" | 23 #include "ash/resources/vector_icons/vector_icons.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 26 #include "grit/ash_resources.h" | 25 #include "grit/ash_resources.h" |
| 27 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/gfx/color_palette.h" | 29 #include "ui/gfx/color_palette.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); | 228 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); |
| 230 virtual_keyboard_view_ = | 229 virtual_keyboard_view_ = |
| 231 AddScrollListItem(bundle.GetLocalizedString( | 230 AddScrollListItem(bundle.GetLocalizedString( |
| 232 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), | 231 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), |
| 233 virtual_keyboard_enabled_, virtual_keyboard_enabled_, | 232 virtual_keyboard_enabled_, virtual_keyboard_enabled_, |
| 234 kSystemMenuKeyboardIcon); | 233 kSystemMenuKeyboardIcon); |
| 235 } | 234 } |
| 236 | 235 |
| 237 void AccessibilityDetailedView::AppendHelpEntries() { | 236 void AccessibilityDetailedView::AppendHelpEntries() { |
| 238 DCHECK(!UseMdMenu()); | 237 DCHECK(!UseMdMenu()); |
| 239 // Currently the help page requires a browser window. | |
| 240 // TODO(yoshiki): show this even on login/lock screen. crbug.com/158286 | |
| 241 if (!TrayPopupUtils::CanOpenWebUISettings(login_)) | |
| 242 return; | |
| 243 | |
| 244 views::View* bottom_row = new View(); | |
| 245 views::BoxLayout* layout = new views::BoxLayout( | |
| 246 views::BoxLayout::kHorizontal, kTrayMenuBottomRowPadding, | |
| 247 kTrayMenuBottomRowPadding, kTrayMenuBottomRowPaddingBetweenItems); | |
| 248 layout->SetDefaultFlex(1); | |
| 249 bottom_row->SetLayoutManager(layout); | |
| 250 | |
| 251 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | |
| 252 | |
| 253 TrayPopupLabelButton* help = new TrayPopupLabelButton( | |
| 254 this, | |
| 255 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LEARN_MORE)); | |
| 256 bottom_row->AddChildView(help); | |
| 257 help_view_ = help; | |
| 258 | |
| 259 TrayPopupLabelButton* settings = new TrayPopupLabelButton( | |
| 260 this, | |
| 261 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SETTINGS)); | |
| 262 bottom_row->AddChildView(settings); | |
| 263 settings_view_ = settings; | |
| 264 | |
| 265 AddChildView(bottom_row); | |
| 266 } | 238 } |
| 267 | 239 |
| 268 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( | 240 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( |
| 269 const base::string16& text, | 241 const base::string16& text, |
| 270 bool highlight, | 242 bool highlight, |
| 271 bool checked, | 243 bool checked, |
| 272 const gfx::VectorIcon& icon) { | 244 const gfx::VectorIcon& icon) { |
| 273 HoverHighlightView* container = new HoverHighlightView(this); | 245 HoverHighlightView* container = new HoverHighlightView(this); |
| 274 if (UseMdMenu()) { | 246 if (UseMdMenu()) { |
| 275 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); | 247 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 if (detailed_popup_) | 464 if (detailed_popup_) |
| 493 detailed_popup_->GetWidget()->Close(); | 465 detailed_popup_->GetWidget()->Close(); |
| 494 if (detailed_menu_) | 466 if (detailed_menu_) |
| 495 detailed_menu_->GetWidget()->Close(); | 467 detailed_menu_->GetWidget()->Close(); |
| 496 } | 468 } |
| 497 | 469 |
| 498 previous_accessibility_state_ = accessibility_state; | 470 previous_accessibility_state_ = accessibility_state; |
| 499 } | 471 } |
| 500 | 472 |
| 501 } // namespace ash | 473 } // namespace ash |
| OLD | NEW |