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 TrayBubbleView::Delegate::~Delegate() {} |
| 173 |
| 174 void TrayBubbleView::Delegate::BubbleViewDestroyed() {} |
| 175 |
| 176 void TrayBubbleView::Delegate::OnMouseEnteredView() {} |
| 177 |
| 178 void TrayBubbleView::Delegate::OnMouseExitedView() {} |
| 179 |
| 180 void TrayBubbleView::Delegate::RegisterAccelerators( |
| 181 const std::vector<ui::Accelerator>& accelerators, |
| 182 TrayBubbleView* tray_bubble_view) {} |
| 183 |
| 184 void TrayBubbleView::Delegate::UnregisterAllAccelerators( |
| 185 TrayBubbleView* tray_bubble_view) {} |
| 186 |
| 187 base::string16 TrayBubbleView::Delegate::GetAccessibleNameForBubble() { |
| 188 return base::string16(); |
| 189 } |
| 190 |
| 191 bool TrayBubbleView::Delegate::ShouldEnableExtraKeyboardAccessibility() { |
| 192 return false; |
| 193 } |
| 194 |
| 195 void TrayBubbleView::Delegate::HideBubble(const TrayBubbleView* bubble_view) {} |
| 196 |
| 197 void TrayBubbleView::Delegate::ProcessGestureEventForBubble( |
| 198 ui::GestureEvent* event) {} |
| 199 |
172 TrayBubbleView::InitParams::InitParams() = default; | 200 TrayBubbleView::InitParams::InitParams() = default; |
173 | 201 |
174 TrayBubbleView::InitParams::InitParams(const InitParams& other) = default; | 202 TrayBubbleView::InitParams::InitParams(const InitParams& other) = default; |
175 | 203 |
176 TrayBubbleView::TrayBubbleView(const InitParams& init_params) | 204 TrayBubbleView::TrayBubbleView(const InitParams& init_params) |
177 : BubbleDialogDelegateView(init_params.anchor_view, | 205 : BubbleDialogDelegateView(init_params.anchor_view, |
178 GetArrowAlignment(init_params.anchor_alignment)), | 206 GetArrowAlignment(init_params.anchor_alignment)), |
179 params_(init_params), | 207 params_(init_params), |
180 layout_(new BottomAlignedBoxLayout(this)), | 208 layout_(new BottomAlignedBoxLayout(this)), |
181 delegate_(init_params.delegate), | 209 delegate_(init_params.delegate), |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 delegate_->OnMouseExitedView(); | 414 delegate_->OnMouseExitedView(); |
387 } | 415 } |
388 | 416 |
389 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 417 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
390 if (delegate_ && CanActivate()) { | 418 if (delegate_ && CanActivate()) { |
391 node_data->role = ui::AX_ROLE_WINDOW; | 419 node_data->role = ui::AX_ROLE_WINDOW; |
392 node_data->SetName(delegate_->GetAccessibleNameForBubble()); | 420 node_data->SetName(delegate_->GetAccessibleNameForBubble()); |
393 } | 421 } |
394 } | 422 } |
395 | 423 |
| 424 void TrayBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
| 425 if (delegate_) |
| 426 delegate_->ProcessGestureEventForBubble(event); |
| 427 |
| 428 if (!event->handled()) |
| 429 BubbleDialogDelegateView::OnGestureEvent(event); |
| 430 } |
| 431 |
396 void TrayBubbleView::MouseMovedOutOfHost() { | 432 void TrayBubbleView::MouseMovedOutOfHost() { |
397 // The mouse was accidentally over the bubble when it opened and the AutoClose | 433 // 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 | 434 // logic was not activated. Now that the user did move the mouse we tell the |
399 // delegate to disable AutoClose. | 435 // delegate to disable AutoClose. |
400 delegate_->OnMouseEnteredView(); | 436 delegate_->OnMouseEnteredView(); |
401 mouse_actively_entered_ = true; | 437 mouse_actively_entered_ = true; |
402 mouse_watcher_->Stop(); | 438 mouse_watcher_->Stop(); |
403 } | 439 } |
404 | 440 |
405 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 441 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 return; | 502 return; |
467 | 503 |
468 // No need to explicitly activate the widget. View::RequestFocus will activate | 504 // No need to explicitly activate the widget. View::RequestFocus will activate |
469 // it if necessary. | 505 // it if necessary. |
470 set_can_activate(true); | 506 set_can_activate(true); |
471 | 507 |
472 view->RequestFocus(); | 508 view->RequestFocus(); |
473 } | 509 } |
474 | 510 |
475 } // namespace views | 511 } // namespace views |
OLD | NEW |