| 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 "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 DialogDelegate* DialogDelegate::AsDialogDelegate() { | 191 DialogDelegate* DialogDelegate::AsDialogDelegate() { |
| 192 return this; | 192 return this; |
| 193 } | 193 } |
| 194 | 194 |
| 195 ClientView* DialogDelegate::CreateClientView(Widget* widget) { | 195 ClientView* DialogDelegate::CreateClientView(Widget* widget) { |
| 196 return new DialogClientView(widget, GetContentsView()); | 196 return new DialogClientView(widget, GetContentsView()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { | 199 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { |
| 200 if (ShouldUseCustomFrame()) | 200 if (ShouldUseCustomFrame()) |
| 201 return CreateDialogFrameView(widget, gfx::Insets()); | 201 return CreateDialogFrameView(widget); |
| 202 return WidgetDelegate::CreateNonClientFrameView(widget); | 202 return WidgetDelegate::CreateNonClientFrameView(widget); |
| 203 } | 203 } |
| 204 | 204 |
| 205 // static | 205 // static |
| 206 NonClientFrameView* DialogDelegate::CreateDialogFrameView( | 206 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { |
| 207 Widget* widget, | |
| 208 const gfx::Insets& content_margins) { | |
| 209 BubbleFrameView* frame = new BubbleFrameView( | 207 BubbleFrameView* frame = new BubbleFrameView( |
| 210 LayoutProvider::Get()->GetInsetsMetric(INSETS_DIALOG_TITLE), | 208 LayoutProvider::Get()->GetInsetsMetric(INSETS_DIALOG_TITLE), |
| 211 content_margins); | 209 gfx::Insets()); |
| 212 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; | 210 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; |
| 213 std::unique_ptr<BubbleBorder> border( | 211 std::unique_ptr<BubbleBorder> border( |
| 214 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); | 212 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); |
| 215 border->set_use_theme_background_color(true); | 213 border->set_use_theme_background_color(true); |
| 216 frame->SetBubbleBorder(std::move(border)); | 214 frame->SetBubbleBorder(std::move(border)); |
| 217 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 215 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
| 218 if (delegate) | 216 if (delegate) |
| 219 frame->SetFootnoteView(delegate->CreateFootnoteView()); | 217 frame->SetFootnoteView(delegate->CreateFootnoteView()); |
| 220 return frame; | 218 return frame; |
| 221 } | 219 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 node_data->role = ui::AX_ROLE_DIALOG; | 266 node_data->role = ui::AX_ROLE_DIALOG; |
| 269 } | 267 } |
| 270 | 268 |
| 271 void DialogDelegateView::ViewHierarchyChanged( | 269 void DialogDelegateView::ViewHierarchyChanged( |
| 272 const ViewHierarchyChangedDetails& details) { | 270 const ViewHierarchyChangedDetails& details) { |
| 273 if (details.is_add && details.child == this && GetWidget()) | 271 if (details.is_add && details.child == this && GetWidget()) |
| 274 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 272 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 275 } | 273 } |
| 276 | 274 |
| 277 } // namespace views | 275 } // namespace views |
| OLD | NEW |