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_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/session/session_controller.h" | 10 #include "ash/session/session_controller.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 system_tray_bubble_->Close(); | 82 system_tray_bubble_->Close(); |
83 delete this; | 83 delete this; |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 SystemTrayBubble* system_tray_bubble_ = nullptr; | 87 SystemTrayBubble* system_tray_bubble_ = nullptr; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(CloseBubbleObserver); | 89 DISALLOW_COPY_AND_ASSIGN(CloseBubbleObserver); |
90 }; | 90 }; |
91 | 91 |
92 class SystemTrayBubbleView : public TrayBubbleView { | |
tdanderson
2017/07/04 21:50:45
I agree with earlier comments regarding the event-
| |
93 public: | |
94 SystemTrayBubbleView(TrayBubbleView::InitParams* init_params, | |
95 SystemTray* tray) | |
96 : TrayBubbleView(*init_params), tray_(tray) {} | |
97 | |
98 // views::View: | |
99 void OnGestureEvent(ui::GestureEvent* event) override { | |
100 if (tray_ && tray_->ProcessGestureEvent(*event, true /* is_on_bubble */)) | |
101 event->SetHandled(); | |
102 else | |
103 TrayBubbleView::OnGestureEvent(event); | |
104 } | |
105 | |
106 private: | |
107 SystemTray* tray_; // Not owned. | |
108 | |
109 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); | |
110 }; // namespace ash | |
111 | |
92 // SystemTrayBubble | 112 // SystemTrayBubble |
93 | 113 |
94 SystemTrayBubble::SystemTrayBubble( | 114 SystemTrayBubble::SystemTrayBubble( |
95 ash::SystemTray* tray, | 115 ash::SystemTray* tray, |
96 const std::vector<ash::SystemTrayItem*>& items, | 116 const std::vector<ash::SystemTrayItem*>& items, |
97 BubbleType bubble_type) | 117 BubbleType bubble_type) |
98 : tray_(tray), | 118 : tray_(tray), |
99 bubble_view_(nullptr), | 119 bubble_view_(nullptr), |
100 items_(items), | 120 items_(items), |
101 bubble_type_(bubble_type), | 121 bubble_type_(bubble_type), |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 tray_->GetBubbleWindowContainer()->AddChild(clipping_window_.get()); | 256 tray_->GetBubbleWindowContainer()->AddChild(clipping_window_.get()); |
237 clipping_window_->Show(); | 257 clipping_window_->Show(); |
238 } | 258 } |
239 clipping_window_->SetBounds(tray_->GetWorkAreaBoundsInScreen()); | 259 clipping_window_->SetBounds(tray_->GetWorkAreaBoundsInScreen()); |
240 init_params->parent_window = clipping_window_.get(); | 260 init_params->parent_window = clipping_window_.get(); |
241 } else { | 261 } else { |
242 init_params->parent_window = tray_->GetBubbleWindowContainer(); | 262 init_params->parent_window = tray_->GetBubbleWindowContainer(); |
243 } | 263 } |
244 | 264 |
245 init_params->anchor_view = anchor; | 265 init_params->anchor_view = anchor; |
246 bubble_view_ = new TrayBubbleView(*init_params); | 266 bubble_view_ = new SystemTrayBubbleView(init_params, tray_); |
247 UpdateBottomPadding(); | 267 UpdateBottomPadding(); |
248 bubble_view_->set_adjust_if_offscreen(false); | 268 bubble_view_->set_adjust_if_offscreen(false); |
249 CreateItemViews(login_status); | 269 CreateItemViews(login_status); |
250 | 270 |
251 if (bubble_view_->CanActivate()) { | 271 if (bubble_view_->CanActivate()) { |
252 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 272 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
253 } | 273 } |
254 } | 274 } |
255 | 275 |
256 void SystemTrayBubble::DestroyItemViews() { | 276 void SystemTrayBubble::DestroyItemViews() { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 } | 402 } |
383 } | 403 } |
384 | 404 |
385 if (focus_view) { | 405 if (focus_view) { |
386 tray_->ActivateBubble(); | 406 tray_->ActivateBubble(); |
387 focus_view->RequestFocus(); | 407 focus_view->RequestFocus(); |
388 } | 408 } |
389 } | 409 } |
390 | 410 |
391 } // namespace ash | 411 } // namespace ash |
OLD | NEW |