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

Side by Side Diff: chrome/browser/ui/ash/multi_user/user_switch_util.cc

Issue 2273103003: [ash-md] Cancels overview mode before switching user profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Cancels overview mode before switching user profiles (test) Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/ash/multi_user/user_switch_util.h" 5 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h"
6 6
7 #include "ash/common/strings/grit/ash_strings.h" 7 #include "ash/common/strings/grit/ash_strings.h"
8 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" 8 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h"
9 #include "ash/common/system/tray/system_tray.h" 9 #include "ash/common/system/tray/system_tray.h"
10 #include "ash/common/wm/overview/window_selector_controller.h"
11 #include "ash/common/wm_shell.h"
10 #include "ash/shell.h" 12 #include "ash/shell.h"
11 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/views/controls/label.h" 15 #include "ui/views/controls/label.h"
14 #include "ui/views/layout/grid_layout.h" 16 #include "ui/views/layout/grid_layout.h"
15 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
16 #include "ui/views/window/dialog_delegate.h" 18 #include "ui/views/window/dialog_delegate.h"
17 19
18 namespace { 20 namespace {
19 21
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 167
166 //////////////////////////////////////////////////////////////////////////////// 168 ////////////////////////////////////////////////////////////////////////////////
167 // Factory function. 169 // Factory function.
168 170
169 void TrySwitchingActiveUser(const base::Callback<void()> on_switch) { 171 void TrySwitchingActiveUser(const base::Callback<void()> on_switch) {
170 // Some unit tests do not have a shell. In that case simply execute. 172 // Some unit tests do not have a shell. In that case simply execute.
171 if (!ash::Shell::HasInstance()) { 173 if (!ash::Shell::HasInstance()) {
172 on_switch.Run(); 174 on_switch.Run();
173 return; 175 return;
174 } 176 }
177
178 // Cancel overview mode when switching user profiles.
179 ash::WindowSelectorController* controller =
180 ash::WmShell::Get()->window_selector_controller();
181 if (controller->IsSelecting())
182 controller->ToggleOverview();
183
175 // If neither screen sharing nor capturing is going on we can immediately 184 // If neither screen sharing nor capturing is going on we can immediately
176 // switch users. 185 // switch users.
177 ash::SystemTray* system_tray = 186 ash::SystemTray* system_tray =
178 ash::Shell::GetInstance()->GetPrimarySystemTray(); 187 ash::Shell::GetInstance()->GetPrimarySystemTray();
179 if (!system_tray->GetScreenShareItem()->is_started() && 188 if (!system_tray->GetScreenShareItem()->is_started() &&
180 !system_tray->GetScreenCaptureItem()->is_started()) { 189 !system_tray->GetScreenCaptureItem()->is_started()) {
181 on_switch.Run(); 190 on_switch.Run();
182 return; 191 return;
183 } 192 }
184 DesktopCastingWarningView::ShowDialog(on_switch); 193 DesktopCastingWarningView::ShowDialog(on_switch);
185 } 194 }
186 195
187 bool TestAndTerminateDesktopCastingWarningForTest(bool accept) { 196 bool TestAndTerminateDesktopCastingWarningForTest(bool accept) {
188 if (!instance_for_test) 197 if (!instance_for_test)
189 return false; 198 return false;
190 if (accept) 199 if (accept)
191 instance_for_test->Accept(); 200 instance_for_test->Accept();
192 delete instance_for_test->GetWidget()->GetNativeWindow(); 201 delete instance_for_test->GetWidget()->GetNativeWindow();
193 CHECK(!instance_for_test); 202 CHECK(!instance_for_test);
194 return true; 203 return true;
195 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698