| 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 base::string16 TrayBubbleView::Delegate::GetAccessibleNameForBubble() { |
| 173 return base::string16(); |
| 174 } |
| 175 |
| 176 bool TrayBubbleView::Delegate::ShouldEnableExtraKeyboardAccessibility() { |
| 177 return false; |
| 178 } |
| 179 |
| 180 bool TrayBubbleView::Delegate::ProcessGestureEventForBubble( |
| 181 ui::GestureEvent* event) { |
| 182 return false; |
| 183 } |
| 184 |
| 172 TrayBubbleView::InitParams::InitParams() = default; | 185 TrayBubbleView::InitParams::InitParams() = default; |
| 173 | 186 |
| 174 TrayBubbleView::InitParams::InitParams(const InitParams& other) = default; | 187 TrayBubbleView::InitParams::InitParams(const InitParams& other) = default; |
| 175 | 188 |
| 176 TrayBubbleView::TrayBubbleView(const InitParams& init_params) | 189 TrayBubbleView::TrayBubbleView(const InitParams& init_params) |
| 177 : BubbleDialogDelegateView(init_params.anchor_view, | 190 : BubbleDialogDelegateView(init_params.anchor_view, |
| 178 GetArrowAlignment(init_params.anchor_alignment)), | 191 GetArrowAlignment(init_params.anchor_alignment)), |
| 179 params_(init_params), | 192 params_(init_params), |
| 180 layout_(new BottomAlignedBoxLayout(this)), | 193 layout_(new BottomAlignedBoxLayout(this)), |
| 181 delegate_(init_params.delegate), | 194 delegate_(init_params.delegate), |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 delegate_->OnMouseExitedView(); | 399 delegate_->OnMouseExitedView(); |
| 387 } | 400 } |
| 388 | 401 |
| 389 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 402 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 390 if (delegate_ && CanActivate()) { | 403 if (delegate_ && CanActivate()) { |
| 391 node_data->role = ui::AX_ROLE_WINDOW; | 404 node_data->role = ui::AX_ROLE_WINDOW; |
| 392 node_data->SetName(delegate_->GetAccessibleNameForBubble()); | 405 node_data->SetName(delegate_->GetAccessibleNameForBubble()); |
| 393 } | 406 } |
| 394 } | 407 } |
| 395 | 408 |
| 409 void TrayBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
| 410 if (!delegate_ || !delegate_->ProcessGestureEventForBubble(event)) |
| 411 BubbleDialogDelegateView::OnGestureEvent(event); |
| 412 } |
| 413 |
| 396 void TrayBubbleView::MouseMovedOutOfHost() { | 414 void TrayBubbleView::MouseMovedOutOfHost() { |
| 397 // The mouse was accidentally over the bubble when it opened and the AutoClose | 415 // 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 | 416 // logic was not activated. Now that the user did move the mouse we tell the |
| 399 // delegate to disable AutoClose. | 417 // delegate to disable AutoClose. |
| 400 delegate_->OnMouseEnteredView(); | 418 delegate_->OnMouseEnteredView(); |
| 401 mouse_actively_entered_ = true; | 419 mouse_actively_entered_ = true; |
| 402 mouse_watcher_->Stop(); | 420 mouse_watcher_->Stop(); |
| 403 } | 421 } |
| 404 | 422 |
| 405 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 423 bool TrayBubbleView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 return; | 484 return; |
| 467 | 485 |
| 468 // No need to explicitly activate the widget. View::RequestFocus will activate | 486 // No need to explicitly activate the widget. View::RequestFocus will activate |
| 469 // it if necessary. | 487 // it if necessary. |
| 470 set_can_activate(true); | 488 set_can_activate(true); |
| 471 | 489 |
| 472 view->RequestFocus(); | 490 view->RequestFocus(); |
| 473 } | 491 } |
| 474 | 492 |
| 475 } // namespace views | 493 } // namespace views |
| OLD | NEW |