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

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

Issue 2700653002: [Ash MD] Remove pre-MD code from TrayImageItem and subclasses (Closed)
Patch Set: comments Created 3 years, 10 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/tray_image_item.cc ('k') | ash/common/system/update/tray_update.cc » ('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"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 } // namespace 81 } // namespace
82 82
83 namespace tray { 83 namespace tray {
84 84
85 class DefaultAccessibilityView : public TrayItemMore { 85 class DefaultAccessibilityView : public TrayItemMore {
86 public: 86 public:
87 explicit DefaultAccessibilityView(SystemTrayItem* owner) 87 explicit DefaultAccessibilityView(SystemTrayItem* owner)
88 : TrayItemMore(owner, true) { 88 : TrayItemMore(owner, true) {
89 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
90 if (!MaterialDesignController::UseMaterialDesignSystemIcons()) {
91 // The icon doesn't change in non-md.
92 SetImage(*bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK)
93 .ToImageSkia());
94 }
95 base::string16 label = 89 base::string16 label =
96 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); 90 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY);
97 SetLabel(label); 91 SetLabel(label);
98 SetAccessibleName(label); 92 SetAccessibleName(label);
99 set_id(test::kAccessibilityTrayItemViewId); 93 set_id(test::kAccessibilityTrayItemViewId);
100 } 94 }
101 95
102 ~DefaultAccessibilityView() override {} 96 ~DefaultAccessibilityView() override {}
103 97
104 protected: 98 protected:
105 // TrayItemMore: 99 // TrayItemMore:
106 void UpdateStyle() override { 100 void UpdateStyle() override {
107 TrayItemMore::UpdateStyle(); 101 TrayItemMore::UpdateStyle();
108
109 if (!UseMdMenu())
110 return;
111
112 std::unique_ptr<TrayPopupItemStyle> style = CreateStyle(); 102 std::unique_ptr<TrayPopupItemStyle> style = CreateStyle();
113 SetImage(gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, 103 SetImage(gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon,
114 style->GetIconColor())); 104 style->GetIconColor()));
115 } 105 }
116 106
117 private: 107 private:
118 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); 108 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView);
119 }; 109 };
120 110
121 //////////////////////////////////////////////////////////////////////////////// 111 ////////////////////////////////////////////////////////////////////////////////
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 333 }
344 } 334 }
345 335
346 } // namespace tray 336 } // namespace tray
347 337
348 //////////////////////////////////////////////////////////////////////////////// 338 ////////////////////////////////////////////////////////////////////////////////
349 // ash::TrayAccessibility 339 // ash::TrayAccessibility
350 340
351 TrayAccessibility::TrayAccessibility(SystemTray* system_tray) 341 TrayAccessibility::TrayAccessibility(SystemTray* system_tray)
352 : TrayImageItem(system_tray, 342 : TrayImageItem(system_tray,
353 IDR_AURA_UBER_TRAY_ACCESSIBILITY, 343 kSystemTrayAccessibilityIcon,
354 UMA_ACCESSIBILITY), 344 UMA_ACCESSIBILITY),
355 default_(NULL), 345 default_(NULL),
356 detailed_popup_(NULL), 346 detailed_popup_(NULL),
357 detailed_menu_(NULL), 347 detailed_menu_(NULL),
358 request_popup_view_state_(A11Y_NONE), 348 request_popup_view_state_(A11Y_NONE),
359 tray_icon_visible_(false), 349 tray_icon_visible_(false),
360 login_(GetCurrentLoginStatus()), 350 login_(GetCurrentLoginStatus()),
361 previous_accessibility_state_(GetAccessibilityState()), 351 previous_accessibility_state_(GetAccessibilityState()),
362 show_a11y_menu_on_lock_screen_(true) { 352 show_a11y_menu_on_lock_screen_(true) {
363 DCHECK(system_tray); 353 DCHECK(system_tray);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 if (detailed_popup_) 455 if (detailed_popup_)
466 detailed_popup_->GetWidget()->Close(); 456 detailed_popup_->GetWidget()->Close();
467 if (detailed_menu_) 457 if (detailed_menu_)
468 detailed_menu_->GetWidget()->Close(); 458 detailed_menu_->GetWidget()->Close();
469 } 459 }
470 460
471 previous_accessibility_state_ = accessibility_state; 461 previous_accessibility_state_ = accessibility_state;
472 } 462 }
473 463
474 } // namespace ash 464 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_image_item.cc ('k') | ash/common/system/update/tray_update.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698