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_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 ClientView* BubbleDialogDelegateView::CreateClientView(Widget* widget) { | 96 ClientView* BubbleDialogDelegateView::CreateClientView(Widget* widget) { |
97 DialogClientView* client = new DialogClientView(widget, GetContentsView()); | 97 DialogClientView* client = new DialogClientView(widget, GetContentsView()); |
98 client->set_button_row_insets(gfx::Insets()); | 98 client->set_button_row_insets(gfx::Insets()); |
99 widget->non_client_view()->set_mirror_client_in_rtl(mirror_arrow_in_rtl_); | 99 widget->non_client_view()->set_mirror_client_in_rtl(mirror_arrow_in_rtl_); |
100 return client; | 100 return client; |
101 } | 101 } |
102 | 102 |
103 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView( | 103 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView( |
104 Widget* widget) { | 104 Widget* widget) { |
105 BubbleFrameView* frame = new BubbleFrameView( | 105 BubbleFrameView* frame = new BubbleFrameView(title_margins(), margins()); |
106 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin), | |
107 margins()); | |
108 // Note: In CreateBubble, the call to SizeToContents() will cause | 106 // Note: In CreateBubble, the call to SizeToContents() will cause |
109 // the relayout that this call requires. | 107 // the relayout that this call requires. |
110 frame->SetTitleFontList(GetTitleFontList()); | 108 frame->SetTitleFontList(GetTitleFontList()); |
111 frame->SetFootnoteView(CreateFootnoteView()); | 109 frame->SetFootnoteView(CreateFootnoteView()); |
112 | 110 |
113 BubbleBorder::Arrow adjusted_arrow = arrow(); | 111 BubbleBorder::Arrow adjusted_arrow = arrow(); |
114 if (base::i18n::IsRTL() && mirror_arrow_in_rtl_) | 112 if (base::i18n::IsRTL() && mirror_arrow_in_rtl_) |
115 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); | 113 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); |
116 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>( | 114 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>( |
117 new BubbleBorder(adjusted_arrow, shadow(), color()))); | 115 new BubbleBorder(adjusted_arrow, shadow(), color()))); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), | 207 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), |
210 anchor_widget_(NULL), | 208 anchor_widget_(NULL), |
211 arrow_(arrow), | 209 arrow_(arrow), |
212 mirror_arrow_in_rtl_(PlatformStyle::kMirrorBubbleArrowInRTLByDefault), | 210 mirror_arrow_in_rtl_(PlatformStyle::kMirrorBubbleArrowInRTLByDefault), |
213 shadow_(BubbleBorder::SMALL_SHADOW), | 211 shadow_(BubbleBorder::SMALL_SHADOW), |
214 color_explicitly_set_(false), | 212 color_explicitly_set_(false), |
215 margins_(kPanelVertMargin, | 213 margins_(kPanelVertMargin, |
216 kPanelHorizMargin, | 214 kPanelHorizMargin, |
217 kPanelVertMargin, | 215 kPanelVertMargin, |
218 kPanelHorizMargin), | 216 kPanelHorizMargin), |
| 217 title_margins_(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin), |
219 accept_events_(true), | 218 accept_events_(true), |
220 border_accepts_events_(true), | 219 border_accepts_events_(true), |
221 adjust_if_offscreen_(true), | 220 adjust_if_offscreen_(true), |
222 parent_window_(NULL) { | 221 parent_window_(NULL) { |
223 if (anchor_view) | 222 if (anchor_view) |
224 SetAnchorView(anchor_view); | 223 SetAnchorView(anchor_view); |
225 UpdateColorsFromTheme(GetNativeTheme()); | 224 UpdateColorsFromTheme(GetNativeTheme()); |
226 } | 225 } |
227 | 226 |
228 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { | 227 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // http://crbug.com/474622 for details. | 319 // http://crbug.com/474622 for details. |
321 if (widget == GetWidget() && visible) { | 320 if (widget == GetWidget() && visible) { |
322 ui::AXNodeData node_data; | 321 ui::AXNodeData node_data; |
323 GetAccessibleNodeData(&node_data); | 322 GetAccessibleNodeData(&node_data); |
324 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) | 323 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) |
325 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 324 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
326 } | 325 } |
327 } | 326 } |
328 | 327 |
329 } // namespace views | 328 } // namespace views |
OLD | NEW |