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