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" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return CreateDialogFrameView(widget); | 193 return CreateDialogFrameView(widget); |
194 return WidgetDelegate::CreateNonClientFrameView(widget); | 194 return WidgetDelegate::CreateNonClientFrameView(widget); |
195 } | 195 } |
196 | 196 |
197 // static | 197 // static |
198 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { | 198 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { |
199 BubbleFrameView* frame = | 199 BubbleFrameView* frame = |
200 new BubbleFrameView(gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, | 200 new BubbleFrameView(gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, |
201 0, kButtonHEdgeMarginNew), | 201 0, kButtonHEdgeMarginNew), |
202 gfx::Insets()); | 202 gfx::Insets()); |
203 #if defined(OS_MACOSX) | |
204 // On Mac, dialogs have no border stroke and use a shadow provided by the OS. | |
205 const BubbleBorder::Shadow kShadow = BubbleBorder::NO_ASSETS; | |
206 #else | |
207 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; | 203 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; |
208 #endif | |
209 scoped_ptr<BubbleBorder> border( | 204 scoped_ptr<BubbleBorder> border( |
210 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); | 205 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); |
211 border->set_use_theme_background_color(true); | 206 border->set_use_theme_background_color(true); |
212 frame->SetBubbleBorder(std::move(border)); | 207 frame->SetBubbleBorder(std::move(border)); |
213 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 208 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
214 if (delegate) { | 209 if (delegate) { |
215 frame->SetTitlebarExtraView( | 210 frame->SetTitlebarExtraView( |
216 make_scoped_ptr(delegate->CreateTitlebarExtraView())); | 211 make_scoped_ptr(delegate->CreateTitlebarExtraView())); |
217 } | 212 } |
218 return frame; | 213 return frame; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 state->role = ui::AX_ROLE_DIALOG; | 260 state->role = ui::AX_ROLE_DIALOG; |
266 } | 261 } |
267 | 262 |
268 void DialogDelegateView::ViewHierarchyChanged( | 263 void DialogDelegateView::ViewHierarchyChanged( |
269 const ViewHierarchyChangedDetails& details) { | 264 const ViewHierarchyChangedDetails& details) { |
270 if (details.is_add && details.child == this && GetWidget()) | 265 if (details.is_add && details.child == this && GetWidget()) |
271 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 266 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
272 } | 267 } |
273 | 268 |
274 } // namespace views | 269 } // namespace views |
OLD | NEW |