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 "ui/views/bubble/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "cc/paint/paint_flags.h" | 10 #include "cc/paint/paint_flags.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 TrayBubbleView* bubble_view_; | 162 TrayBubbleView* bubble_view_; |
163 | 163 |
164 DISALLOW_COPY_AND_ASSIGN(BottomAlignedBoxLayout); | 164 DISALLOW_COPY_AND_ASSIGN(BottomAlignedBoxLayout); |
165 }; | 165 }; |
166 | 166 |
167 } // namespace internal | 167 } // namespace internal |
168 | 168 |
169 using internal::TrayBubbleContentMask; | 169 using internal::TrayBubbleContentMask; |
170 using internal::BottomAlignedBoxLayout; | 170 using internal::BottomAlignedBoxLayout; |
171 | 171 |
| 172 bool TrayBubbleView::Delegate::ProcessGestureEventOnBubbleView( |
| 173 ui::GestureEvent* event, |
| 174 View* target) { |
| 175 return false; |
| 176 } |
| 177 |
172 TrayBubbleView::InitParams::InitParams() = default; | 178 TrayBubbleView::InitParams::InitParams() = default; |
173 | 179 |
174 TrayBubbleView::InitParams::InitParams(const InitParams& other) = default; | 180 TrayBubbleView::InitParams::InitParams(const InitParams& other) = default; |
175 | 181 |
176 TrayBubbleView::TrayBubbleView(const InitParams& init_params) | 182 TrayBubbleView::TrayBubbleView(const InitParams& init_params) |
177 : BubbleDialogDelegateView(init_params.anchor_view, | 183 : BubbleDialogDelegateView(init_params.anchor_view, |
178 GetArrowAlignment(init_params.anchor_alignment)), | 184 GetArrowAlignment(init_params.anchor_alignment)), |
179 params_(init_params), | 185 params_(init_params), |
180 layout_(new BottomAlignedBoxLayout(this)), | 186 layout_(new BottomAlignedBoxLayout(this)), |
181 delegate_(init_params.delegate), | 187 delegate_(init_params.delegate), |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 delegate_->OnMouseExitedView(); | 392 delegate_->OnMouseExitedView(); |
387 } | 393 } |
388 | 394 |
389 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 395 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
390 if (delegate_ && CanActivate()) { | 396 if (delegate_ && CanActivate()) { |
391 node_data->role = ui::AX_ROLE_WINDOW; | 397 node_data->role = ui::AX_ROLE_WINDOW; |
392 node_data->SetName(delegate_->GetAccessibleNameForBubble()); | 398 node_data->SetName(delegate_->GetAccessibleNameForBubble()); |
393 } | 399 } |
394 } | 400 } |
395 | 401 |
| 402 void TrayBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
| 403 if (delegate_ && delegate_->ProcessGestureEventOnBubbleView(event, this)) |
| 404 event->SetHandled(); |
| 405 else |
| 406 BubbleDialogDelegateView::OnGestureEvent(event); |
| 407 } |
| 408 |
396 void TrayBubbleView::MouseMovedOutOfHost() { | 409 void TrayBubbleView::MouseMovedOutOfHost() { |
397 // The mouse was accidentally over the bubble when it opened and the AutoClose | 410 // The mouse was accidentally over the bubble when it opened and the AutoClose |
398 // logic was not activated. Now that the user did move the mouse we tell the | 411 // logic was not activated. Now that the user did move the mouse we tell the |
399 // delegate to disable AutoClose. | 412 // delegate to disable AutoClose. |
400 delegate_->OnMouseEnteredView(); | 413 delegate_->OnMouseEnteredView(); |
401 mouse_actively_entered_ = true; | 414 mouse_actively_entered_ = true; |
402 mouse_watcher_->Stop(); | 415 mouse_watcher_->Stop(); |
403 } | 416 } |
404 | 417 |
405 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 418 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 return; | 479 return; |
467 | 480 |
468 // No need to explicitly activate the widget. View::RequestFocus will activate | 481 // No need to explicitly activate the widget. View::RequestFocus will activate |
469 // it if necessary. | 482 // it if necessary. |
470 set_can_activate(true); | 483 set_can_activate(true); |
471 | 484 |
472 view->RequestFocus(); | 485 view->RequestFocus(); |
473 } | 486 } |
474 | 487 |
475 } // namespace views | 488 } // namespace views |
OLD | NEW |