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 void TrayBubbleView::Delegate::BubbleViewDestroyed() {} |
| 173 |
| 174 void TrayBubbleView::Delegate::OnMouseEnteredView() {} |
| 175 |
| 176 void TrayBubbleView::Delegate::OnMouseExitedView() {} |
| 177 |
| 178 void TrayBubbleView::Delegate::RegisterAccelerators( |
| 179 const std::vector<ui::Accelerator>& accelerators, |
| 180 TrayBubbleView* tray_bubble_view) {} |
| 181 |
| 182 void TrayBubbleView::Delegate::UnregisterAllAccelerators( |
| 183 TrayBubbleView* tray_bubble_view) {} |
| 184 |
| 185 base::string16 TrayBubbleView::Delegate::GetAccessibleNameForBubble() { |
| 186 return base::string16(); |
| 187 } |
| 188 |
| 189 bool TrayBubbleView::Delegate::ShouldEnableExtraKeyboardAccessibility() { |
| 190 return false; |
| 191 } |
| 192 |
| 193 void TrayBubbleView::Delegate::HideBubble(const TrayBubbleView* bubble_view) {} |
| 194 |
| 195 bool TrayBubbleView::Delegate::ProcessGestureEventForBubble( |
| 196 ui::GestureEvent* event) { |
| 197 return false; |
| 198 } |
| 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_ || !delegate_->ProcessGestureEventForBubble(event)) |
| 426 BubbleDialogDelegateView::OnGestureEvent(event); |
| 427 } |
| 428 |
396 void TrayBubbleView::MouseMovedOutOfHost() { | 429 void TrayBubbleView::MouseMovedOutOfHost() { |
397 // The mouse was accidentally over the bubble when it opened and the AutoClose | 430 // 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 | 431 // logic was not activated. Now that the user did move the mouse we tell the |
399 // delegate to disable AutoClose. | 432 // delegate to disable AutoClose. |
400 delegate_->OnMouseEnteredView(); | 433 delegate_->OnMouseEnteredView(); |
401 mouse_actively_entered_ = true; | 434 mouse_actively_entered_ = true; |
402 mouse_watcher_->Stop(); | 435 mouse_watcher_->Stop(); |
403 } | 436 } |
404 | 437 |
405 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 438 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 return; | 499 return; |
467 | 500 |
468 // No need to explicitly activate the widget. View::RequestFocus will activate | 501 // No need to explicitly activate the widget. View::RequestFocus will activate |
469 // it if necessary. | 502 // it if necessary. |
470 set_can_activate(true); | 503 set_can_activate(true); |
471 | 504 |
472 view->RequestFocus(); | 505 view->RequestFocus(); |
473 } | 506 } |
474 | 507 |
475 } // namespace views | 508 } // namespace views |
OLD | NEW |