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

Side by Side Diff: chrome/browser/chromeos/login/ui/login_display_host_impl.cc

Issue 1778873002: Replace Increment/DecrementKeepAliveCount by ScopedKeepAlives (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@KAObserver
Patch Set: replace the commented dcheck by a dlog Created 4 years, 9 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/chromeos/login/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/audio/sounds.h" 10 #include "ash/audio/sounds.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/chromeos/login/wizard_controller.h" 47 #include "chrome/browser/chromeos/login/wizard_controller.h"
48 #include "chrome/browser/chromeos/mobile_config.h" 48 #include "chrome/browser/chromeos/mobile_config.h"
49 #include "chrome/browser/chromeos/net/delay_network_call.h" 49 #include "chrome/browser/chromeos/net/delay_network_call.h"
50 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 50 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
51 #include "chrome/browser/chromeos/policy/enrollment_config.h" 51 #include "chrome/browser/chromeos/policy/enrollment_config.h"
52 #include "chrome/browser/chromeos/settings/cros_settings.h" 52 #include "chrome/browser/chromeos/settings/cros_settings.h"
53 #include "chrome/browser/chromeos/system/device_disabling_manager.h" 53 #include "chrome/browser/chromeos/system/device_disabling_manager.h"
54 #include "chrome/browser/chromeos/system/input_device_settings.h" 54 #include "chrome/browser/chromeos/system/input_device_settings.h"
55 #include "chrome/browser/chromeos/system/timezone_util.h" 55 #include "chrome/browser/chromeos/system/timezone_util.h"
56 #include "chrome/browser/chromeos/ui/focus_ring_controller.h" 56 #include "chrome/browser/chromeos/ui/focus_ring_controller.h"
57 #include "chrome/browser/lifetime/application_lifetime.h" 57 #include "chrome/browser/lifetime/keep_alive_types.h"
58 #include "chrome/browser/lifetime/scoped_keep_alive.h"
58 #include "chrome/browser/profiles/profile_manager.h" 59 #include "chrome/browser/profiles/profile_manager.h"
59 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" 60 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
60 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 61 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
61 #include "chrome/common/chrome_constants.h" 62 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_switches.h" 63 #include "chrome/common/chrome_switches.h"
63 #include "chrome/common/pref_names.h" 64 #include "chrome/common/pref_names.h"
64 #include "chrome/grit/browser_resources.h" 65 #include "chrome/grit/browser_resources.h"
65 #include "chromeos/audio/chromeos_sounds.h" 66 #include "chromeos/audio/chromeos_sounds.h"
66 #include "chromeos/chromeos_constants.h" 67 #include "chromeos/chromeos_constants.h"
67 #include "chromeos/chromeos_switches.h" 68 #include "chromeos/chromeos_switches.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 content::NotificationService::AllSources()); 305 content::NotificationService::AllSources());
305 306
306 // Login screen is moved to lock screen container when user logs in. 307 // Login screen is moved to lock screen container when user logs in.
307 registrar_.Add(this, 308 registrar_.Add(this,
308 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 309 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
309 content::NotificationService::AllSources()); 310 content::NotificationService::AllSources());
310 311
311 DCHECK(default_host() == nullptr); 312 DCHECK(default_host() == nullptr);
312 default_host_ = this; 313 default_host_ = this;
313 314
314 // Make sure chrome won't exit while we are at login/oobe screen. 315 keep_alive_.reset(
315 chrome::IncrementKeepAliveCount(); 316 new ScopedKeepAlive(KeepAliveOrigin::LOGIN_DISPLAY_HOST_IMPL,
317 KeepAliveRestartOption::DISABLED));
316 318
317 bool is_registered = StartupUtils::IsDeviceRegistered(); 319 bool is_registered = StartupUtils::IsDeviceRegistered();
318 bool zero_delay_enabled = WizardController::IsZeroDelayEnabled(); 320 bool zero_delay_enabled = WizardController::IsZeroDelayEnabled();
319 bool disable_boot_animation = 321 bool disable_boot_animation =
320 base::CommandLine::ForCurrentProcess()->HasSwitch( 322 base::CommandLine::ForCurrentProcess()->HasSwitch(
321 switches::kDisableBootAnimation); 323 switches::kDisableBootAnimation);
322 324
323 waiting_for_wallpaper_load_ = !zero_delay_enabled && 325 waiting_for_wallpaper_load_ = !zero_delay_enabled &&
324 (!is_registered || !disable_boot_animation); 326 (!is_registered || !disable_boot_animation);
325 327
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 gfx::Screen::GetScreen()->RemoveObserver(this); 396 gfx::Screen::GetScreen()->RemoveObserver(this);
395 397
396 if (login_view_ && login_window_) 398 if (login_view_ && login_window_)
397 login_window_->RemoveRemovalsObserver(this); 399 login_window_->RemoveRemovalsObserver(this);
398 400
399 ResetKeyboardOverscrollOverride(); 401 ResetKeyboardOverscrollOverride();
400 402
401 views::FocusManager::set_arrow_key_traversal_enabled(false); 403 views::FocusManager::set_arrow_key_traversal_enabled(false);
402 ResetLoginWindowAndView(); 404 ResetLoginWindowAndView();
403 405
404 // Let chrome process exit after login/oobe screen if needed. 406 keep_alive_.reset();
405 chrome::DecrementKeepAliveCount();
406 407
407 default_host_ = nullptr; 408 default_host_ = nullptr;
408 // TODO(tengs): This should be refactored. See crbug.com/314934. 409 // TODO(tengs): This should be refactored. See crbug.com/314934.
409 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { 410 if (user_manager::UserManager::Get()->IsCurrentUserNew()) {
410 // DriveOptInController will delete itself when finished. 411 // DriveOptInController will delete itself when finished.
411 (new DriveFirstRunController( 412 (new DriveFirstRunController(
412 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode(); 413 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode();
413 } 414 }
414 } 415 }
415 416
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1284
1284 locale_util::SwitchLanguageCallback callback( 1285 locale_util::SwitchLanguageCallback callback(
1285 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); 1286 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data))));
1286 1287
1287 // Load locale keyboards here. Hardware layout would be automatically enabled. 1288 // Load locale keyboards here. Hardware layout would be automatically enabled.
1288 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, 1289 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */,
1289 callback, ProfileManager::GetActiveUserProfile()); 1290 callback, ProfileManager::GetActiveUserProfile());
1290 } 1291 }
1291 1292
1292 } // namespace chromeos 1293 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/login_display_host_impl.h ('k') | chrome/browser/devtools/devtools_sanity_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698