| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/common/accelerators/exit_warning_handler.h" | 5 #include "ash/common/accelerators/exit_warning_handler.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_delegate.h" | 7 #include "ash/common/shell_delegate.h" |
| 8 #include "ash/common/wm_root_window_controller.h" | 8 #include "ash/common/wm_root_window_controller.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| 11 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "grit/ash_strings.h" | 15 #include "grit/ash_strings.h" |
| 16 #include "ui/accessibility/ax_view_state.h" | 16 #include "ui/accessibility/ax_node_data.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/font_list.h" | 20 #include "ui/gfx/font_list.h" |
| 21 #include "ui/gfx/text_utils.h" | 21 #include "ui/gfx/text_utils.h" |
| 22 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" |
| 23 #include "ui/views/layout/fill_layout.h" | 23 #include "ui/views/layout/fill_layout.h" |
| 24 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
| 25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 26 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 void OnPaint(gfx::Canvas* canvas) override { | 75 void OnPaint(gfx::Canvas* canvas) override { |
| 76 SkPaint paint; | 76 SkPaint paint; |
| 77 paint.setStyle(SkPaint::kFill_Style); | 77 paint.setStyle(SkPaint::kFill_Style); |
| 78 paint.setColor(kWindowBackgroundColor); | 78 paint.setColor(kWindowBackgroundColor); |
| 79 canvas->DrawRoundRect(GetLocalBounds(), kWindowCornerRadius, paint); | 79 canvas->DrawRoundRect(GetLocalBounds(), kWindowCornerRadius, paint); |
| 80 views::WidgetDelegateView::OnPaint(canvas); | 80 views::WidgetDelegateView::OnPaint(canvas); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void GetAccessibleState(ui::AXViewState* state) override { | 83 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { |
| 84 state->name = accessible_name_; | 84 node_data->SetName(accessible_name_); |
| 85 state->role = ui::AX_ROLE_ALERT; | 85 node_data->role = ui::AX_ROLE_ALERT; |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 base::string16 text_; | 89 base::string16 text_; |
| 90 base::string16 accessible_name_; | 90 base::string16 accessible_name_; |
| 91 int text_width_; | 91 int text_width_; |
| 92 int width_; | 92 int width_; |
| 93 int height_; | 93 int height_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(ExitWarningWidgetDelegateView); | 95 DISALLOW_COPY_AND_ASSIGN(ExitWarningWidgetDelegateView); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 widget_->Show(); | 169 widget_->Show(); |
| 170 | 170 |
| 171 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 171 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ExitWarningHandler::Hide() { | 174 void ExitWarningHandler::Hide() { |
| 175 widget_.reset(); | 175 widget_.reset(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace ash | 178 } // namespace ash |
| OLD | NEW |