| 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/window/dialog_delegate.h" | 5 #include "ui/views/window/dialog_delegate.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "ui/accessibility/ax_node_data.h" | 11 #include "ui/accessibility/ax_node_data.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/gfx/color_palette.h" | 13 #include "ui/gfx/color_palette.h" |
| 14 #include "ui/strings/grit/ui_strings.h" | 14 #include "ui/strings/grit/ui_strings.h" |
| 15 #include "ui/views/bubble/bubble_border.h" | 15 #include "ui/views/bubble/bubble_border.h" |
| 16 #include "ui/views/bubble/bubble_frame_view.h" | 16 #include "ui/views/bubble/bubble_frame_view.h" |
| 17 #include "ui/views/controls/button/label_button.h" | 17 #include "ui/views/controls/button/label_button.h" |
| 18 #include "ui/views/layout/layout_constants.h" | 18 #include "ui/views/layout/layout_constants.h" |
| 19 #include "ui/views/style/platform_style.h" | 19 #include "ui/views/style/platform_style.h" |
| 20 #include "ui/views/views_delegate.h" |
| 20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 21 #include "ui/views/widget/widget_observer.h" | 22 #include "ui/views/widget/widget_observer.h" |
| 22 #include "ui/views/window/dialog_client_view.h" | 23 #include "ui/views/window/dialog_client_view.h" |
| 23 | 24 |
| 24 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 25 #include "ui/base/win/shell.h" | 26 #include "ui/base/win/shell.h" |
| 26 #endif | 27 #endif |
| 27 | 28 |
| 28 namespace views { | 29 namespace views { |
| 29 | 30 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { | 193 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { |
| 193 if (ShouldUseCustomFrame()) | 194 if (ShouldUseCustomFrame()) |
| 194 return CreateDialogFrameView(widget, gfx::Insets()); | 195 return CreateDialogFrameView(widget, gfx::Insets()); |
| 195 return WidgetDelegate::CreateNonClientFrameView(widget); | 196 return WidgetDelegate::CreateNonClientFrameView(widget); |
| 196 } | 197 } |
| 197 | 198 |
| 198 // static | 199 // static |
| 199 NonClientFrameView* DialogDelegate::CreateDialogFrameView( | 200 NonClientFrameView* DialogDelegate::CreateDialogFrameView( |
| 200 Widget* widget, | 201 Widget* widget, |
| 201 const gfx::Insets& content_margins) { | 202 const gfx::Insets& content_margins) { |
| 202 BubbleFrameView* frame = | 203 BubbleFrameView* frame = new BubbleFrameView( |
| 203 new BubbleFrameView(gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, | 204 ViewsDelegate::GetInstance()->GetDialogFrameViewInsets(), |
| 204 0, kButtonHEdgeMarginNew), | 205 content_margins); |
| 205 content_margins); | |
| 206 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; | 206 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; |
| 207 std::unique_ptr<BubbleBorder> border( | 207 std::unique_ptr<BubbleBorder> border( |
| 208 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); | 208 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); |
| 209 border->set_use_theme_background_color(true); | 209 border->set_use_theme_background_color(true); |
| 210 frame->SetBubbleBorder(std::move(border)); | 210 frame->SetBubbleBorder(std::move(border)); |
| 211 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 211 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
| 212 if (delegate) | 212 if (delegate) |
| 213 frame->SetFootnoteView(delegate->CreateFootnoteView()); | 213 frame->SetFootnoteView(delegate->CreateFootnoteView()); |
| 214 return frame; | 214 return frame; |
| 215 } | 215 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 node_data->role = ui::AX_ROLE_DIALOG; | 261 node_data->role = ui::AX_ROLE_DIALOG; |
| 262 } | 262 } |
| 263 | 263 |
| 264 void DialogDelegateView::ViewHierarchyChanged( | 264 void DialogDelegateView::ViewHierarchyChanged( |
| 265 const ViewHierarchyChangedDetails& details) { | 265 const ViewHierarchyChangedDetails& details) { |
| 266 if (details.is_add && details.child == this && GetWidget()) | 266 if (details.is_add && details.child == this && GetWidget()) |
| 267 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 267 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace views | 270 } // namespace views |
| OLD | NEW |