| 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/accelerators/exit_warning_handler.h" | 5 #include "ash/accelerators/exit_warning_handler.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| 11 #include "ash/shell_port.h" |
| 11 #include "ash/strings/grit/ash_strings.h" | 12 #include "ash/strings/grit/ash_strings.h" |
| 12 #include "ash/wm_shell.h" | |
| 13 #include "ash/wm_window.h" | 13 #include "ash/wm_window.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "ui/accessibility/ax_node_data.h" | 17 #include "ui/accessibility/ax_node_data.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/font_list.h" | 21 #include "ui/gfx/font_list.h" |
| 22 #include "ui/gfx/text_utils.h" | 22 #include "ui/gfx/text_utils.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Note: If a timer is outstanding, it is stopped in its destructor. | 102 // Note: If a timer is outstanding, it is stopped in its destructor. |
| 103 Hide(); | 103 Hide(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ExitWarningHandler::HandleAccelerator() { | 106 void ExitWarningHandler::HandleAccelerator() { |
| 107 switch (state_) { | 107 switch (state_) { |
| 108 case IDLE: | 108 case IDLE: |
| 109 state_ = WAIT_FOR_DOUBLE_PRESS; | 109 state_ = WAIT_FOR_DOUBLE_PRESS; |
| 110 Show(); | 110 Show(); |
| 111 StartTimer(); | 111 StartTimer(); |
| 112 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_FIRST_Q); | 112 ShellPort::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_FIRST_Q); |
| 113 break; | 113 break; |
| 114 case WAIT_FOR_DOUBLE_PRESS: | 114 case WAIT_FOR_DOUBLE_PRESS: |
| 115 state_ = EXITING; | 115 state_ = EXITING; |
| 116 CancelTimer(); | 116 CancelTimer(); |
| 117 Hide(); | 117 Hide(); |
| 118 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_SECOND_Q); | 118 ShellPort::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_SECOND_Q); |
| 119 Shell::Get()->shell_delegate()->Exit(); | 119 Shell::Get()->shell_delegate()->Exit(); |
| 120 break; | 120 break; |
| 121 case EXITING: | 121 case EXITING: |
| 122 break; | 122 break; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ExitWarningHandler::TimerAction() { | 126 void ExitWarningHandler::TimerAction() { |
| 127 Hide(); | 127 Hide(); |
| 128 if (state_ == WAIT_FOR_DOUBLE_PRESS) | 128 if (state_ == WAIT_FOR_DOUBLE_PRESS) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 widget_->Show(); | 167 widget_->Show(); |
| 168 | 168 |
| 169 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 169 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void ExitWarningHandler::Hide() { | 172 void ExitWarningHandler::Hide() { |
| 173 widget_.reset(); | 173 widget_.reset(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace ash | 176 } // namespace ash |
| OLD | NEW |