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" | |
39 #include "ui/base/events.h" | 38 #include "ui/base/events.h" |
40 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/compositor/layer.h" | 40 #include "ui/compositor/layer.h" |
42 #include "ui/gfx/canvas.h" | 41 #include "ui/gfx/canvas.h" |
43 #include "ui/gfx/screen.h" | 42 #include "ui/gfx/screen.h" |
44 #include "ui/gfx/skia_util.h" | 43 #include "ui/gfx/skia_util.h" |
45 #include "ui/views/border.h" | 44 #include "ui/views/border.h" |
46 #include "ui/views/controls/label.h" | 45 #include "ui/views/controls/label.h" |
47 #include "ui/views/layout/box_layout.h" | 46 #include "ui/views/layout/box_layout.h" |
48 #include "ui/views/layout/fill_layout.h" | 47 #include "ui/views/layout/fill_layout.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 void SystemTray::AnchorUpdated() { | 415 void SystemTray::AnchorUpdated() { |
417 if (notification_bubble_.get()) { | 416 if (notification_bubble_.get()) { |
418 notification_bubble_->bubble_view()->UpdateBubble(); | 417 notification_bubble_->bubble_view()->UpdateBubble(); |
419 // Ensure that the notification buble is above the launcher/status area. | 418 // Ensure that the notification buble is above the launcher/status area. |
420 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); | 419 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); |
421 } | 420 } |
422 if (bubble_.get()) | 421 if (bubble_.get()) |
423 bubble_->bubble_view()->UpdateBubble(); | 422 bubble_->bubble_view()->UpdateBubble(); |
424 } | 423 } |
425 | 424 |
| 425 string16 SystemTray::GetAccessibleName() { |
| 426 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); |
| 427 } |
| 428 |
426 bool SystemTray::PerformAction(const ui::Event& event) { | 429 bool SystemTray::PerformAction(const ui::Event& event) { |
427 // If we're already showing the default view, hide it; otherwise, show it | 430 // If we're already showing the default view, hide it; otherwise, show it |
428 // (and hide any popup that's currently shown). | 431 // (and hide any popup that's currently shown). |
429 if (bubble_.get() && | 432 if (bubble_.get() && |
430 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) { | 433 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) { |
431 bubble_->Close(); | 434 bubble_->Close(); |
432 } else { | 435 } else { |
433 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; | 436 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; |
434 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { | 437 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { |
435 const ui::LocatedEvent& located_event = | 438 const ui::LocatedEvent& located_event = |
436 static_cast<const ui::LocatedEvent&>(event); | 439 static_cast<const ui::LocatedEvent&>(event); |
437 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { | 440 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { |
438 gfx::Point point(located_event.x(), 0); | 441 gfx::Point point(located_event.x(), 0); |
439 ConvertPointToWidget(this, &point); | 442 ConvertPointToWidget(this, &point); |
440 arrow_offset = point.x(); | 443 arrow_offset = point.x(); |
441 } | 444 } |
442 } | 445 } |
443 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 446 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
444 } | 447 } |
445 return true; | 448 return true; |
446 } | 449 } |
447 | 450 |
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 | |
454 } // namespace ash | 451 } // namespace ash |
OLD | NEW |