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

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

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « ash/system/tray_accessibility.h ('k') | ash/system/tray_update.h » ('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/system/tray_accessibility.h" 5 #include "ash/system/tray_accessibility.h"
6 6
7 #include "ash/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/metrics/user_metrics_recorder.h" 8 #include "ash/metrics/user_metrics_recorder.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/tray/hover_highlight_view.h" 10 #include "ash/system/tray/hover_highlight_view.h"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/system/tray/system_tray_delegate.h" 12 #include "ash/system/tray/system_tray_delegate.h"
13 #include "ash/system/tray/system_tray_notifier.h" 13 #include "ash/system/tray/system_tray_notifier.h"
14 #include "ash/system/tray/tray_constants.h" 14 #include "ash/system/tray/tray_constants.h"
15 #include "ash/system/tray/tray_details_view.h" 15 #include "ash/system/tray/tray_details_view.h"
16 #include "ash/system/tray/tray_item_more.h" 16 #include "ash/system/tray/tray_item_more.h"
17 #include "ash/system/tray/tray_popup_label_button.h" 17 #include "ash/system/tray/tray_popup_label_button.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
20 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
24 #include "ui/views/controls/image_view.h" 24 #include "ui/views/controls/image_view.h"
25 #include "ui/views/controls/label.h" 25 #include "ui/views/controls/label.h"
26 #include "ui/views/layout/box_layout.h" 26 #include "ui/views/layout/box_layout.h"
27 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
28 28
29 namespace ash { 29 namespace ash {
30 namespace internal {
31
32 namespace { 30 namespace {
33 31
34 enum AccessibilityState { 32 enum AccessibilityState {
35 A11Y_NONE = 0, 33 A11Y_NONE = 0,
36 A11Y_SPOKEN_FEEDBACK = 1 << 0, 34 A11Y_SPOKEN_FEEDBACK = 1 << 0,
37 A11Y_HIGH_CONTRAST = 1 << 1, 35 A11Y_HIGH_CONTRAST = 1 << 1,
38 A11Y_SCREEN_MAGNIFIER = 1 << 2, 36 A11Y_SCREEN_MAGNIFIER = 1 << 2,
39 A11Y_LARGE_CURSOR = 1 << 3, 37 A11Y_LARGE_CURSOR = 1 << 3,
40 A11Y_AUTOCLICK = 1 << 4, 38 A11Y_AUTOCLICK = 1 << 4,
41 A11Y_VIRTUAL_KEYBOARD = 1 << 5, 39 A11Y_VIRTUAL_KEYBOARD = 1 << 5,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 83 }
86 84
87 virtual ~DefaultAccessibilityView() { 85 virtual ~DefaultAccessibilityView() {
88 } 86 }
89 87
90 private: 88 private:
91 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); 89 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView);
92 }; 90 };
93 91
94 //////////////////////////////////////////////////////////////////////////////// 92 ////////////////////////////////////////////////////////////////////////////////
95 // ash::internal::tray::AccessibilityPopupView 93 // ash::tray::AccessibilityPopupView
96 94
97 AccessibilityPopupView::AccessibilityPopupView(SystemTrayItem* owner, 95 AccessibilityPopupView::AccessibilityPopupView(SystemTrayItem* owner,
98 uint32 enabled_state_bits) 96 uint32 enabled_state_bits)
99 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK), 97 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK),
100 label_(CreateLabel(enabled_state_bits)) { 98 label_(CreateLabel(enabled_state_bits)) {
101 InitView(label_); 99 InitView(label_);
102 } 100 }
103 101
104 views::Label* AccessibilityPopupView::CreateLabel(uint32 enabled_state_bits) { 102 views::Label* AccessibilityPopupView::CreateLabel(uint32 enabled_state_bits) {
105 DCHECK((enabled_state_bits & 103 DCHECK((enabled_state_bits &
106 (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED)) != 0); 104 (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED)) != 0);
107 base::string16 text; 105 base::string16 text;
108 if (enabled_state_bits & A11Y_BRAILLE_DISPLAY_CONNECTED) { 106 if (enabled_state_bits & A11Y_BRAILLE_DISPLAY_CONNECTED) {
109 text.append(l10n_util::GetStringUTF16( 107 text.append(l10n_util::GetStringUTF16(
110 IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED_BUBBLE)); 108 IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED_BUBBLE));
111 } 109 }
112 if (enabled_state_bits & A11Y_SPOKEN_FEEDBACK) { 110 if (enabled_state_bits & A11Y_SPOKEN_FEEDBACK) {
113 if (!text.empty()) 111 if (!text.empty())
114 text.append(base::ASCIIToUTF16(" ")); 112 text.append(base::ASCIIToUTF16(" "));
115 text.append(l10n_util::GetStringUTF16( 113 text.append(l10n_util::GetStringUTF16(
116 IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_ENABLED_BUBBLE)); 114 IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_ENABLED_BUBBLE));
117 } 115 }
118 views::Label* label = new views::Label(text); 116 views::Label* label = new views::Label(text);
119 label->SetMultiLine(true); 117 label->SetMultiLine(true);
120 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 118 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
121 return label; 119 return label;
122 } 120 }
123 121
124 //////////////////////////////////////////////////////////////////////////////// 122 ////////////////////////////////////////////////////////////////////////////////
125 // ash::internal::tray::AccessibilityDetailedView 123 // ash::tray::AccessibilityDetailedView
126 124
127 AccessibilityDetailedView::AccessibilityDetailedView( 125 AccessibilityDetailedView::AccessibilityDetailedView(
128 SystemTrayItem* owner, user::LoginStatus login) : 126 SystemTrayItem* owner, user::LoginStatus login) :
129 TrayDetailsView(owner), 127 TrayDetailsView(owner),
130 spoken_feedback_view_(NULL), 128 spoken_feedback_view_(NULL),
131 high_contrast_view_(NULL), 129 high_contrast_view_(NULL),
132 screen_magnifier_view_(NULL), 130 screen_magnifier_view_(NULL),
133 large_cursor_view_(NULL), 131 large_cursor_view_(NULL),
134 help_view_(NULL), 132 help_view_(NULL),
135 settings_view_(NULL), 133 settings_view_(NULL),
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 Shell::GetInstance()->system_tray_delegate(); 299 Shell::GetInstance()->system_tray_delegate();
302 if (sender == help_view_) 300 if (sender == help_view_)
303 tray_delegate->ShowAccessibilityHelp(); 301 tray_delegate->ShowAccessibilityHelp();
304 else if (sender == settings_view_) 302 else if (sender == settings_view_)
305 tray_delegate->ShowAccessibilitySettings(); 303 tray_delegate->ShowAccessibilitySettings();
306 } 304 }
307 305
308 } // namespace tray 306 } // namespace tray
309 307
310 //////////////////////////////////////////////////////////////////////////////// 308 ////////////////////////////////////////////////////////////////////////////////
311 // ash::internal::TrayAccessibility 309 // ash::TrayAccessibility
312 310
313 TrayAccessibility::TrayAccessibility(SystemTray* system_tray) 311 TrayAccessibility::TrayAccessibility(SystemTray* system_tray)
314 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_ACCESSIBILITY), 312 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_ACCESSIBILITY),
315 default_(NULL), 313 default_(NULL),
316 detailed_popup_(NULL), 314 detailed_popup_(NULL),
317 detailed_menu_(NULL), 315 detailed_menu_(NULL),
318 request_popup_view_state_(A11Y_NONE), 316 request_popup_view_state_(A11Y_NONE),
319 tray_icon_visible_(false), 317 tray_icon_visible_(false),
320 login_(GetCurrentLoginStatus()), 318 login_(GetCurrentLoginStatus()),
321 previous_accessibility_state_(GetAccessibilityState()), 319 previous_accessibility_state_(GetAccessibilityState()),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } else { 425 } else {
428 if (detailed_popup_) 426 if (detailed_popup_)
429 detailed_popup_->GetWidget()->Close(); 427 detailed_popup_->GetWidget()->Close();
430 if (detailed_menu_) 428 if (detailed_menu_)
431 detailed_menu_->GetWidget()->Close(); 429 detailed_menu_->GetWidget()->Close();
432 } 430 }
433 431
434 previous_accessibility_state_ = accessibility_state; 432 previous_accessibility_state_ = accessibility_state;
435 } 433 }
436 434
437 } // namespace internal
438 } // namespace ash 435 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray_accessibility.h ('k') | ash/system/tray_update.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698