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

Side by Side Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 2493973003: Display "Restart to update" dialog to Chrome OS users. (Closed)
Patch Set: Rebased CL Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/lifetime/application_lifetime.h" 5 #include "chrome/browser/lifetime/application_lifetime.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 if (notified) 351 if (notified)
352 return; 352 return;
353 notified = true; 353 notified = true;
354 content::NotificationService::current()->Notify( 354 content::NotificationService::current()->Notify(
355 chrome::NOTIFICATION_APP_TERMINATING, 355 chrome::NOTIFICATION_APP_TERMINATING,
356 content::NotificationService::AllSources(), 356 content::NotificationService::AllSources(),
357 content::NotificationService::NoDetails()); 357 content::NotificationService::NoDetails());
358 } 358 }
359 359
360 void NotifyAndTerminate(bool fast_path) { 360 void NotifyAndTerminate(bool fast_path) {
361 NotifyAndTerminate(fast_path, RebootPolicy::kOptionalReboot);
362 }
363
364 void NotifyAndTerminate(bool fast_path, RebootPolicy reboot_policy) {
361 #if defined(OS_CHROMEOS) 365 #if defined(OS_CHROMEOS)
362 static bool notified = false; 366 static bool notified = false;
363 // Return if a shutdown request has already been sent. 367 // Return if a shutdown request has already been sent.
364 if (notified) 368 if (notified)
365 return; 369 return;
366 notified = true; 370 notified = true;
367 #endif 371 #endif
368 372
369 if (fast_path) 373 if (fast_path)
370 NotifyAppTerminating(); 374 NotifyAppTerminating();
371 375
372 #if defined(OS_CHROMEOS) 376 #if defined(OS_CHROMEOS)
373 if (chromeos::PowerPolicyController::IsInitialized()) 377 if (chromeos::PowerPolicyController::IsInitialized())
374 chromeos::PowerPolicyController::Get()->NotifyChromeIsExiting(); 378 chromeos::PowerPolicyController::Get()->NotifyChromeIsExiting();
375 379
376 if (base::SysInfo::IsRunningOnChromeOS()) { 380 if (base::SysInfo::IsRunningOnChromeOS()) {
377 // If we're on a ChromeOS device, reboot if an update has been applied, 381 // If we're on a ChromeOS device, reboot if an update has been applied,
378 // or else signal the session manager to log out. 382 // or else signal the session manager to log out.
379 chromeos::UpdateEngineClient* update_engine_client 383 chromeos::UpdateEngineClient* update_engine_client =
380 = chromeos::DBusThreadManager::Get()->GetUpdateEngineClient(); 384 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient();
381 if (update_engine_client->GetLastStatus().status == 385 if (update_engine_client->GetLastStatus().status ==
382 chromeos::UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { 386 chromeos::UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT ||
387 reboot_policy == RebootPolicy::kForceReboot) {
383 update_engine_client->RebootAfterUpdate(); 388 update_engine_client->RebootAfterUpdate();
384 } else if (g_send_stop_request_to_session_manager) { 389 } else if (g_send_stop_request_to_session_manager) {
385 // Don't ask SessionManager to stop session if the shutdown request comes 390 // Don't ask SessionManager to stop session if the shutdown request comes
386 // from session manager. 391 // from session manager.
387 chromeos::DBusThreadManager::Get()->GetSessionManagerClient() 392 chromeos::DBusThreadManager::Get()
393 ->GetSessionManagerClient()
388 ->StopSession(); 394 ->StopSession();
389 } 395 }
390 } else { 396 } else {
391 if (g_send_stop_request_to_session_manager) { 397 if (g_send_stop_request_to_session_manager) {
392 // If running the Chrome OS build, but we're not on the device, act 398 // If running the Chrome OS build, but we're not on the device, act
393 // as if we received signal from SessionManager. 399 // as if we received signal from SessionManager.
394 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 400 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
395 base::Bind(&ExitCleanly)); 401 base::Bind(&ExitCleanly));
396 } 402 }
397 } 403 }
398 #endif 404 #endif
399 } 405 }
400 406
401 #if !defined(OS_ANDROID) 407 #if !defined(OS_ANDROID)
402 void OnAppExiting() { 408 void OnAppExiting() {
403 static bool notified = false; 409 static bool notified = false;
404 if (notified) 410 if (notified)
405 return; 411 return;
406 notified = true; 412 notified = true;
407 HandleAppExitingForPlatform(); 413 HandleAppExitingForPlatform();
408 } 414 }
409 #endif // !defined(OS_ANDROID) 415 #endif // !defined(OS_ANDROID)
410 416
411 } // namespace chrome 417 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698