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

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

Issue 10543158: Do not toggle Applist with Search key press when accessibility is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge similar functions Created 8 years, 6 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 | Annotate | Revision Log
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/system/tray_accessibility.h" 5 #include "ash/system/tray_accessibility.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "ash/system/tray/tray_views.h" 10 #include "ash/system/tray/tray_views.h"
11 #include "grit/ash_strings.h" 11 #include "grit/ash_strings.h"
12 #include "grit/ui_resources_standard.h" 12 #include "grit/ui_resources_standard.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
15 #include "ui/views/controls/image_view.h" 15 #include "ui/views/controls/image_view.h"
16 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
17 #include "ui/views/layout/box_layout.h" 17 #include "ui/views/layout/box_layout.h"
18 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
(...skipping 20 matching lines...) Expand all
39 IDS_ASH_STATUS_TRAY_DISABLE_SPOKEN_FEEDBACK); 39 IDS_ASH_STATUS_TRAY_DISABLE_SPOKEN_FEEDBACK);
40 AddChildView(new views::Label(label)); 40 AddChildView(new views::Label(label));
41 SetAccessibleName(label); 41 SetAccessibleName(label);
42 } 42 }
43 43
44 virtual ~DefaultAccessibilityView() {} 44 virtual ~DefaultAccessibilityView() {}
45 45
46 protected: 46 protected:
47 // Overridden from ActionableView. 47 // Overridden from ActionableView.
48 virtual bool PerformAction(const views::Event& event) OVERRIDE { 48 virtual bool PerformAction(const views::Event& event) OVERRIDE {
49 ash::Shell::GetInstance()->tray_delegate()->SetEnableSpokenFeedback(false); 49 if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
50 Shell::GetInstance()->delegate()->ToggleSpokenFeedback();
50 GetWidget()->Close(); 51 GetWidget()->Close();
51 return true; 52 return true;
52 } 53 }
53 54
54 private: 55 private:
55 56
56 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); 57 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView);
57 }; 58 };
58 59
59 TrayAccessibility::TrayAccessibility() 60 TrayAccessibility::TrayAccessibility()
60 : TrayImageItem(IDR_AURA_UBER_TRAY_ACCESSIBILITY), 61 : TrayImageItem(IDR_AURA_UBER_TRAY_ACCESSIBILITY),
61 default_(NULL), 62 default_(NULL),
62 detailed_(NULL), 63 detailed_(NULL),
63 string_id_(0) { 64 string_id_(0) {
64 } 65 }
65 66
66 TrayAccessibility::~TrayAccessibility() {} 67 TrayAccessibility::~TrayAccessibility() {}
67 68
68 bool TrayAccessibility::GetInitialVisibility() { 69 bool TrayAccessibility::GetInitialVisibility() {
69 return ash::Shell::GetInstance()->tray_delegate()->IsInAccessibilityMode(); 70 return Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled();
70 } 71 }
71 72
72 views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) { 73 views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) {
73 if (!ash::Shell::GetInstance()->tray_delegate()->IsInAccessibilityMode()) 74 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
74 return NULL; 75 return NULL;
75 76
76 DCHECK(string_id_); 77 DCHECK(string_id_);
77 CHECK(default_ == NULL); 78 CHECK(default_ == NULL);
78 default_ = new DefaultAccessibilityView(); 79 default_ = new DefaultAccessibilityView();
79 80
80 return default_; 81 return default_;
81 } 82 }
82 83
83 views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) { 84 views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 string_id_ = string_id; 119 string_id_ = string_id;
119 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); 120 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
120 } else if (detailed_) { 121 } else if (detailed_) {
121 string_id_ = 0; 122 string_id_ = 0;
122 detailed_->GetWidget()->Close(); 123 detailed_->GetWidget()->Close();
123 } 124 }
124 } 125 }
125 126
126 } // namespace internal 127 } // namespace internal
127 } // namespace ash 128 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698