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/status_area/status_area_view.h" | 5 #include "ash/status_area/status_area_view.h" |
6 | 6 |
7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
8 #include "ash/focus_cycler.h" | 8 #include "ash/focus_cycler.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/system/tray/system_tray.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "grit/ui_resources.h" | 13 #include "grit/ui_resources.h" |
13 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
17 #include "ui/views/accessible_pane_view.h" | 18 #include "ui/views/accessible_pane_view.h" |
18 #include "ui/views/layout/fill_layout.h" | 19 #include "ui/views/layout/fill_layout.h" |
19 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
20 | 21 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 53 |
53 const views::Widget* StatusAreaView::GetWidget() const { | 54 const views::Widget* StatusAreaView::GetWidget() const { |
54 return View::GetWidget(); | 55 return View::GetWidget(); |
55 } | 56 } |
56 | 57 |
57 bool StatusAreaView::CanActivate() const { | 58 bool StatusAreaView::CanActivate() const { |
58 // We don't want mouse clicks to activate us, but we need to allow | 59 // We don't want mouse clicks to activate us, but we need to allow |
59 // activation when the user is using the keyboard (FocusCycler). | 60 // activation when the user is using the keyboard (FocusCycler). |
60 const FocusCycler* focus_cycler = focus_cycler_for_testing_ ? | 61 const FocusCycler* focus_cycler = focus_cycler_for_testing_ ? |
61 focus_cycler_for_testing_ : Shell::GetInstance()->focus_cycler(); | 62 focus_cycler_for_testing_ : Shell::GetInstance()->focus_cycler(); |
62 return focus_cycler->widget_activating() == GetWidget(); | 63 |
| 64 ash::SystemTray* tray = ash::Shell::GetInstance()->tray(); |
| 65 bool manually_activating = tray && tray->is_taking_focus(); |
| 66 |
| 67 return manually_activating || |
| 68 focus_cycler->widget_activating() == GetWidget(); |
63 } | 69 } |
64 | 70 |
65 void StatusAreaView::DeleteDelegate() { | 71 void StatusAreaView::DeleteDelegate() { |
66 } | 72 } |
67 | 73 |
68 ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents) { | 74 ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents) { |
69 if (!contents) { | 75 if (!contents) { |
70 contents = new views::View; | 76 contents = new views::View; |
71 contents->set_focusable(true); | 77 contents->set_focusable(true); |
72 } | 78 } |
(...skipping 11 matching lines...) Expand all Loading... |
84 widget->set_focus_on_creation(false); | 90 widget->set_focus_on_creation(false); |
85 status_area_view->AddChildView(contents); | 91 status_area_view->AddChildView(contents); |
86 widget->SetContentsView(status_area_view); | 92 widget->SetContentsView(status_area_view); |
87 widget->Show(); | 93 widget->Show(); |
88 widget->GetNativeView()->SetName("StatusAreaView"); | 94 widget->GetNativeView()->SetName("StatusAreaView"); |
89 return widget; | 95 return widget; |
90 } | 96 } |
91 | 97 |
92 } // namespace internal | 98 } // namespace internal |
93 } // namespace ash | 99 } // namespace ash |
OLD | NEW |