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/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell/panel_window.h" | 8 #include "ash/shell/panel_window.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/system/audio/tray_volume.h" | 10 #include "ash/system/audio/tray_volume.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "ash/system/tray_accessibility.h" | 28 #include "ash/system/tray_accessibility.h" |
29 #include "ash/system/tray_caps_lock.h" | 29 #include "ash/system/tray_caps_lock.h" |
30 #include "ash/system/tray_update.h" | 30 #include "ash/system/tray_update.h" |
31 #include "ash/system/user/login_status.h" | 31 #include "ash/system/user/login_status.h" |
32 #include "ash/system/user/tray_user.h" | 32 #include "ash/system/user/tray_user.h" |
33 #include "base/logging.h" | 33 #include "base/logging.h" |
34 #include "base/timer.h" | 34 #include "base/timer.h" |
35 #include "base/utf_string_conversions.h" | 35 #include "base/utf_string_conversions.h" |
36 #include "grit/ash_strings.h" | 36 #include "grit/ash_strings.h" |
37 #include "ui/aura/root_window.h" | 37 #include "ui/aura/root_window.h" |
| 38 #include "ui/base/accessibility/accessible_view_state.h" |
38 #include "ui/base/events.h" | 39 #include "ui/base/events.h" |
39 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/compositor/layer.h" | 41 #include "ui/compositor/layer.h" |
41 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
42 #include "ui/gfx/screen.h" | 43 #include "ui/gfx/screen.h" |
43 #include "ui/gfx/skia_util.h" | 44 #include "ui/gfx/skia_util.h" |
44 #include "ui/views/border.h" | 45 #include "ui/views/border.h" |
45 #include "ui/views/controls/label.h" | 46 #include "ui/views/controls/label.h" |
46 #include "ui/views/layout/box_layout.h" | 47 #include "ui/views/layout/box_layout.h" |
47 #include "ui/views/layout/fill_layout.h" | 48 #include "ui/views/layout/fill_layout.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void SystemTray::AnchorUpdated() { | 416 void SystemTray::AnchorUpdated() { |
416 if (notification_bubble_.get()) { | 417 if (notification_bubble_.get()) { |
417 notification_bubble_->bubble_view()->UpdateBubble(); | 418 notification_bubble_->bubble_view()->UpdateBubble(); |
418 // Ensure that the notification buble is above the launcher/status area. | 419 // Ensure that the notification buble is above the launcher/status area. |
419 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); | 420 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); |
420 } | 421 } |
421 if (bubble_.get()) | 422 if (bubble_.get()) |
422 bubble_->bubble_view()->UpdateBubble(); | 423 bubble_->bubble_view()->UpdateBubble(); |
423 } | 424 } |
424 | 425 |
425 string16 SystemTray::GetAccessibleName() { | |
426 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); | |
427 } | |
428 | |
429 bool SystemTray::PerformAction(const ui::Event& event) { | 426 bool SystemTray::PerformAction(const ui::Event& event) { |
430 // If we're already showing the default view, hide it; otherwise, show it | 427 // If we're already showing the default view, hide it; otherwise, show it |
431 // (and hide any popup that's currently shown). | 428 // (and hide any popup that's currently shown). |
432 if (bubble_.get() && | 429 if (bubble_.get() && |
433 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) { | 430 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) { |
434 bubble_->Close(); | 431 bubble_->Close(); |
435 } else { | 432 } else { |
436 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; | 433 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; |
437 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { | 434 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { |
438 const ui::LocatedEvent& located_event = | 435 const ui::LocatedEvent& located_event = |
439 static_cast<const ui::LocatedEvent&>(event); | 436 static_cast<const ui::LocatedEvent&>(event); |
440 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { | 437 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { |
441 gfx::Point point(located_event.x(), 0); | 438 gfx::Point point(located_event.x(), 0); |
442 ConvertPointToWidget(this, &point); | 439 ConvertPointToWidget(this, &point); |
443 arrow_offset = point.x(); | 440 arrow_offset = point.x(); |
444 } | 441 } |
445 } | 442 } |
446 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 443 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
447 } | 444 } |
448 return true; | 445 return true; |
449 } | 446 } |
450 | 447 |
| 448 void SystemTray::GetAccessibleState(ui::AccessibleViewState* state) { |
| 449 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
| 450 state->name = l10n_util::GetStringUTF16( |
| 451 IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); |
| 452 } |
| 453 |
451 } // namespace ash | 454 } // namespace ash |
OLD | NEW |