| 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> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/gfx/color_palette.h" | 12 #include "ui/gfx/color_palette.h" |
| 11 #include "ui/strings/grit/ui_strings.h" | 13 #include "ui/strings/grit/ui_strings.h" |
| 12 #include "ui/views/bubble/bubble_border.h" | 14 #include "ui/views/bubble/bubble_border.h" |
| 13 #include "ui/views/bubble/bubble_frame_view.h" | 15 #include "ui/views/bubble/bubble_frame_view.h" |
| 14 #include "ui/views/controls/button/label_button.h" | 16 #include "ui/views/controls/button/label_button.h" |
| 15 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_observer.h" | 18 #include "ui/views/widget/widget_observer.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); | 197 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); |
| 196 #if defined(OS_MACOSX) | 198 #if defined(OS_MACOSX) |
| 197 // On Mac, dialogs have no border stroke and use a shadow provided by the OS. | 199 // On Mac, dialogs have no border stroke and use a shadow provided by the OS. |
| 198 const BubbleBorder::Shadow kShadow = BubbleBorder::NO_ASSETS; | 200 const BubbleBorder::Shadow kShadow = BubbleBorder::NO_ASSETS; |
| 199 #else | 201 #else |
| 200 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; | 202 const BubbleBorder::Shadow kShadow = BubbleBorder::SMALL_SHADOW; |
| 201 #endif | 203 #endif |
| 202 scoped_ptr<BubbleBorder> border( | 204 scoped_ptr<BubbleBorder> border( |
| 203 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); | 205 new BubbleBorder(BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor)); |
| 204 border->set_use_theme_background_color(true); | 206 border->set_use_theme_background_color(true); |
| 205 frame->SetBubbleBorder(border.Pass()); | 207 frame->SetBubbleBorder(std::move(border)); |
| 206 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 208 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
| 207 if (delegate) { | 209 if (delegate) { |
| 208 View* titlebar_view = delegate->CreateTitlebarExtraView(); | 210 View* titlebar_view = delegate->CreateTitlebarExtraView(); |
| 209 if (titlebar_view) | 211 if (titlebar_view) |
| 210 frame->SetTitlebarExtraView(titlebar_view); | 212 frame->SetTitlebarExtraView(titlebar_view); |
| 211 } | 213 } |
| 212 return frame; | 214 return frame; |
| 213 } | 215 } |
| 214 | 216 |
| 215 bool DialogDelegate::UseNewStyleForThisDialog() const { | 217 bool DialogDelegate::UseNewStyleForThisDialog() const { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 state->role = ui::AX_ROLE_DIALOG; | 261 state->role = ui::AX_ROLE_DIALOG; |
| 260 } | 262 } |
| 261 | 263 |
| 262 void DialogDelegateView::ViewHierarchyChanged( | 264 void DialogDelegateView::ViewHierarchyChanged( |
| 263 const ViewHierarchyChangedDetails& details) { | 265 const ViewHierarchyChangedDetails& details) { |
| 264 if (details.is_add && details.child == this && GetWidget()) | 266 if (details.is_add && details.child == this && GetWidget()) |
| 265 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 267 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 266 } | 268 } |
| 267 | 269 |
| 268 } // namespace views | 270 } // namespace views |
| OLD | NEW |