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

Side by Side Diff: ash/common/system/tray_accessibility.cc

Issue 2429923002: Implement all system menu title row buttons for Ash MD (Closed)
Patch Set: OS_WIN define in tests Created 4 years, 2 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
« no previous file with comments | « ash/common/system/tray_accessibility.h ('k') | ash/resources/vector_icons/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 20 #include "ash/common/system/tray/tray_popup_label_button.h"
21 #include "ash/common/system/tray/tray_utils.h"
21 #include "ash/common/wm_shell.h" 22 #include "ash/common/wm_shell.h"
22 #include "ash/resources/vector_icons/vector_icons.h" 23 #include "ash/resources/vector_icons/vector_icons.h"
23 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
24 #include "grit/ash_resources.h" 25 #include "grit/ash_resources.h"
25 #include "grit/ash_strings.h" 26 #include "grit/ash_strings.h"
26 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
28 #include "ui/gfx/color_palette.h" 29 #include "ui/gfx/color_palette.h"
29 #include "ui/gfx/image/image.h" 30 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/paint_vector_icon.h" 31 #include "ui/gfx/paint_vector_icon.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 virtual_keyboard_view_ = 224 virtual_keyboard_view_ =
224 AddScrollListItem(bundle.GetLocalizedString( 225 AddScrollListItem(bundle.GetLocalizedString(
225 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), 226 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD),
226 virtual_keyboard_enabled_, virtual_keyboard_enabled_, 227 virtual_keyboard_enabled_, virtual_keyboard_enabled_,
227 kSystemMenuKeyboardIcon); 228 kSystemMenuKeyboardIcon);
228 } 229 }
229 230
230 void AccessibilityDetailedView::AppendHelpEntries() { 231 void AccessibilityDetailedView::AppendHelpEntries() {
231 // Currently the help page requires a browser window. 232 // Currently the help page requires a browser window.
232 // TODO(yoshiki): show this even on login/lock screen. crbug.com/158286 233 // TODO(yoshiki): show this even on login/lock screen. crbug.com/158286
233 if (login_ == LoginStatus::NOT_LOGGED_IN || login_ == LoginStatus::LOCKED || 234 if (!CanOpenWebUISettings(login_))
234 WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen())
235 return; 235 return;
236 236
237 views::View* bottom_row = new View(); 237 views::View* bottom_row = new View();
238 views::BoxLayout* layout = new views::BoxLayout( 238 views::BoxLayout* layout = new views::BoxLayout(
239 views::BoxLayout::kHorizontal, kTrayMenuBottomRowPadding, 239 views::BoxLayout::kHorizontal, kTrayMenuBottomRowPadding,
240 kTrayMenuBottomRowPadding, kTrayMenuBottomRowPaddingBetweenItems); 240 kTrayMenuBottomRowPadding, kTrayMenuBottomRowPaddingBetweenItems);
241 layout->SetDefaultFlex(1); 241 layout->SetDefaultFlex(1);
242 bottom_row->SetLayoutManager(layout); 242 bottom_row->SetLayoutManager(layout);
243 243
244 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 244 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 : ash::UMA_STATUS_AREA_ENABLE_VIRTUAL_KEYBOARD; 315 : ash::UMA_STATUS_AREA_ENABLE_VIRTUAL_KEYBOARD;
316 delegate->SetVirtualKeyboardEnabled(!delegate->IsVirtualKeyboardEnabled()); 316 delegate->SetVirtualKeyboardEnabled(!delegate->IsVirtualKeyboardEnabled());
317 } else { 317 } else {
318 return; 318 return;
319 } 319 }
320 WmShell::Get()->RecordUserMetricsAction(user_action); 320 WmShell::Get()->RecordUserMetricsAction(user_action);
321 } 321 }
322 322
323 void AccessibilityDetailedView::HandleButtonPressed(views::Button* sender, 323 void AccessibilityDetailedView::HandleButtonPressed(views::Button* sender,
324 const ui::Event& event) { 324 const ui::Event& event) {
325 if (MaterialDesignController::UseMaterialDesignSystemIcons()) 325 if (sender == help_view_)
326 return; 326 ShowHelp();
327 else if (sender == settings_view_)
328 ShowSettings();
329 }
327 330
328 SystemTrayController* controller = WmShell::Get()->system_tray_controller(); 331 void AccessibilityDetailedView::CreateExtraTitleRowButtons() {
329 if (sender == help_view_) 332 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
330 controller->ShowAccessibilityHelp(); 333 help_view_ = title_row()->AddHelpButton(this, login_);
331 else if (sender == settings_view_) 334 settings_view_ = title_row()->AddSettingsButton(this, login_);
332 controller->ShowAccessibilitySettings(); 335 }
333 else
334 return;
335 owner()->system_tray()->CloseSystemBubble();
336 } 336 }
337 337
338 void AccessibilityDetailedView::ShowSettings() { 338 void AccessibilityDetailedView::ShowSettings() {
339 WmShell::Get()->system_tray_controller()->ShowAccessibilitySettings(); 339 if (CanOpenWebUISettings(login_)) {
340 WmShell::Get()->system_tray_controller()->ShowAccessibilitySettings();
341 owner()->system_tray()->CloseSystemBubble();
342 }
343 }
344
345 void AccessibilityDetailedView::ShowHelp() {
346 if (CanOpenWebUISettings(login_)) {
347 WmShell::Get()->system_tray_controller()->ShowAccessibilityHelp();
348 owner()->system_tray()->CloseSystemBubble();
349 }
340 } 350 }
341 351
342 } // namespace tray 352 } // namespace tray
343 353
344 //////////////////////////////////////////////////////////////////////////////// 354 ////////////////////////////////////////////////////////////////////////////////
345 // ash::TrayAccessibility 355 // ash::TrayAccessibility
346 356
347 TrayAccessibility::TrayAccessibility(SystemTray* system_tray) 357 TrayAccessibility::TrayAccessibility(SystemTray* system_tray)
348 : TrayImageItem(system_tray, 358 : TrayImageItem(system_tray,
349 IDR_AURA_UBER_TRAY_ACCESSIBILITY, 359 IDR_AURA_UBER_TRAY_ACCESSIBILITY,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 if (detailed_popup_) 471 if (detailed_popup_)
462 detailed_popup_->GetWidget()->Close(); 472 detailed_popup_->GetWidget()->Close();
463 if (detailed_menu_) 473 if (detailed_menu_)
464 detailed_menu_->GetWidget()->Close(); 474 detailed_menu_->GetWidget()->Close();
465 } 475 }
466 476
467 previous_accessibility_state_ = accessibility_state; 477 previous_accessibility_state_ = accessibility_state;
468 } 478 }
469 479
470 } // namespace ash 480 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray_accessibility.h ('k') | ash/resources/vector_icons/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698