| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/bubble_dialog_delegate.h" | 5 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView( | 100 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView( |
| 101 Widget* widget) { | 101 Widget* widget) { |
| 102 BubbleFrameView* frame = new BubbleFrameView( | 102 BubbleFrameView* frame = new BubbleFrameView( |
| 103 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin), | 103 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin), |
| 104 margins()); | 104 margins()); |
| 105 // Note: In CreateBubble, the call to SizeToContents() will cause | 105 // Note: In CreateBubble, the call to SizeToContents() will cause |
| 106 // the relayout that this call requires. | 106 // the relayout that this call requires. |
| 107 frame->SetTitleFontList(GetTitleFontList()); | 107 frame->SetTitleFontList(GetTitleFontList()); |
| 108 frame->SetFootnoteView(CreateFootnoteView()); | 108 frame->SetFootnoteView(CreateFootnoteView()); |
| 109 frame->set_mirror_arrow_in_rtl(mirror_arrow_in_rtl_); |
| 109 | 110 |
| 110 BubbleBorder::Arrow adjusted_arrow = arrow(); | 111 BubbleBorder::Arrow adjusted_arrow = arrow(); |
| 111 if (base::i18n::IsRTL()) | 112 if (base::i18n::IsRTL() && mirror_arrow_in_rtl_) |
| 112 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); | 113 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); |
| 113 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>( | 114 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>( |
| 114 new BubbleBorder(adjusted_arrow, shadow(), color()))); | 115 new BubbleBorder(adjusted_arrow, shadow(), color()))); |
| 115 return frame; | 116 return frame; |
| 116 } | 117 } |
| 117 | 118 |
| 118 void BubbleDialogDelegateView::GetAccessibleState(ui::AXViewState* state) { | 119 void BubbleDialogDelegateView::GetAccessibleState(ui::AXViewState* state) { |
| 119 state->role = ui::AX_ROLE_DIALOG; | 120 state->role = ui::AX_ROLE_DIALOG; |
| 120 } | 121 } |
| 121 | 122 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 199 |
| 199 BubbleDialogDelegateView::BubbleDialogDelegateView() | 200 BubbleDialogDelegateView::BubbleDialogDelegateView() |
| 200 : BubbleDialogDelegateView(nullptr, BubbleBorder::TOP_LEFT) {} | 201 : BubbleDialogDelegateView(nullptr, BubbleBorder::TOP_LEFT) {} |
| 201 | 202 |
| 202 BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view, | 203 BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view, |
| 203 BubbleBorder::Arrow arrow) | 204 BubbleBorder::Arrow arrow) |
| 204 : close_on_deactivate_(true), | 205 : close_on_deactivate_(true), |
| 205 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), | 206 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), |
| 206 anchor_widget_(NULL), | 207 anchor_widget_(NULL), |
| 207 arrow_(arrow), | 208 arrow_(arrow), |
| 209 mirror_arrow_in_rtl_(true), |
| 208 shadow_(BubbleBorder::SMALL_SHADOW), | 210 shadow_(BubbleBorder::SMALL_SHADOW), |
| 209 color_explicitly_set_(false), | 211 color_explicitly_set_(false), |
| 210 margins_(kPanelVertMargin, | 212 margins_(kPanelVertMargin, |
| 211 kPanelHorizMargin, | 213 kPanelHorizMargin, |
| 212 kPanelVertMargin, | 214 kPanelVertMargin, |
| 213 kPanelHorizMargin), | 215 kPanelHorizMargin), |
| 214 accept_events_(true), | 216 accept_events_(true), |
| 215 border_accepts_events_(true), | 217 border_accepts_events_(true), |
| 216 adjust_if_offscreen_(true), | 218 adjust_if_offscreen_(true), |
| 217 parent_window_(NULL) { | 219 parent_window_(NULL) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // http://crbug.com/474622 for details. | 312 // http://crbug.com/474622 for details. |
| 311 if (widget == GetWidget() && visible) { | 313 if (widget == GetWidget() && visible) { |
| 312 ui::AXViewState state; | 314 ui::AXViewState state; |
| 313 GetAccessibleState(&state); | 315 GetAccessibleState(&state); |
| 314 if (state.role == ui::AX_ROLE_ALERT_DIALOG) | 316 if (state.role == ui::AX_ROLE_ALERT_DIALOG) |
| 315 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 317 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 316 } | 318 } |
| 317 } | 319 } |
| 318 | 320 |
| 319 } // namespace views | 321 } // namespace views |
| OLD | NEW |