Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: ash/accelerators/exit_warning_handler.cc

Issue 2118593002: mash: Migrate ShellDelegate ownership and access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/accelerators/debug_commands.cc ('k') | ash/app_list/app_list_presenter_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/shell_delegate.h"
7 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/shell_delegate.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "grit/ash_strings.h" 14 #include "grit/ash_strings.h"
15 #include "ui/accessibility/ax_view_state.h" 15 #include "ui/accessibility/ax_view_state.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.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"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 ExitWarningHandler::ExitWarningHandler() 100 ExitWarningHandler::ExitWarningHandler()
101 : state_(IDLE), stub_timer_for_test_(false) {} 101 : state_(IDLE), stub_timer_for_test_(false) {}
102 102
103 ExitWarningHandler::~ExitWarningHandler() { 103 ExitWarningHandler::~ExitWarningHandler() {
104 // Note: If a timer is outstanding, it is stopped in its destructor. 104 // Note: If a timer is outstanding, it is stopped in its destructor.
105 Hide(); 105 Hide();
106 } 106 }
107 107
108 void ExitWarningHandler::HandleAccelerator() { 108 void ExitWarningHandler::HandleAccelerator() {
109 ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
110 switch (state_) { 109 switch (state_) {
111 case IDLE: 110 case IDLE:
112 state_ = WAIT_FOR_DOUBLE_PRESS; 111 state_ = WAIT_FOR_DOUBLE_PRESS;
113 Show(); 112 Show();
114 StartTimer(); 113 StartTimer();
115 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_FIRST_Q); 114 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_FIRST_Q);
116 break; 115 break;
117 case WAIT_FOR_DOUBLE_PRESS: 116 case WAIT_FOR_DOUBLE_PRESS:
118 state_ = EXITING; 117 state_ = EXITING;
119 CancelTimer(); 118 CancelTimer();
120 Hide(); 119 Hide();
121 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_SECOND_Q); 120 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_SECOND_Q);
122 shell_delegate->Exit(); 121 WmShell::Get()->delegate()->Exit();
123 break; 122 break;
124 case EXITING: 123 case EXITING:
125 break; 124 break;
126 default: 125 default:
127 NOTREACHED(); 126 NOTREACHED();
128 break; 127 break;
129 } 128 }
130 } 129 }
131 130
132 void ExitWarningHandler::TimerAction() { 131 void ExitWarningHandler::TimerAction() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 widget_->Show(); 173 widget_->Show();
175 174
176 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 175 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
177 } 176 }
178 177
179 void ExitWarningHandler::Hide() { 178 void ExitWarningHandler::Hide() {
180 widget_.reset(); 179 widget_.reset();
181 } 180 }
182 181
183 } // namespace ash 182 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/debug_commands.cc ('k') | ash/app_list/app_list_presenter_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698