| 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 "chrome/browser/chromeos/login/chrome_restart_request.h" | 5 #include "chrome/browser/chromeos/login/chrome_restart_request.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 JsonPrefStore::GetTaskRunnerForFile( | 319 JsonPrefStore::GetTaskRunnerForFile( |
| 320 base::FilePath(chrome::kLocalStorePoolName), | 320 base::FilePath(chrome::kLocalStorePoolName), |
| 321 BrowserThread::GetBlockingPool()); | 321 BrowserThread::GetBlockingPool()); |
| 322 local_state_task_runner->PostTaskAndReply( | 322 local_state_task_runner->PostTaskAndReply( |
| 323 FROM_HERE, | 323 FROM_HERE, |
| 324 base::Bind(&EnsureLocalStateIsWritten), | 324 base::Bind(&EnsureLocalStateIsWritten), |
| 325 base::Bind(&ChromeRestartRequest::RestartJob, AsWeakPtr())); | 325 base::Bind(&ChromeRestartRequest::RestartJob, AsWeakPtr())); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void ChromeRestartRequest::RestartJob() { | 328 void ChromeRestartRequest::RestartJob() { |
| 329 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 329 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 330 | 330 |
| 331 DBusThreadManager::Get()->GetSessionManagerClient()->RestartJob( | 331 DBusThreadManager::Get()->GetSessionManagerClient()->RestartJob( |
| 332 pid_, command_line_); | 332 pid_, command_line_); |
| 333 | 333 |
| 334 delete this; | 334 delete this; |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // namespace | 337 } // namespace |
| 338 | 338 |
| 339 std::string GetOffTheRecordCommandLine( | 339 std::string GetOffTheRecordCommandLine( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 357 if (!is_oobe_completed) | 357 if (!is_oobe_completed) |
| 358 otr_switches.SetString(switches::kOobeGuestSession, std::string()); | 358 otr_switches.SetString(switches::kOobeGuestSession, std::string()); |
| 359 | 359 |
| 360 return DeriveCommandLine(start_url, | 360 return DeriveCommandLine(start_url, |
| 361 base_command_line, | 361 base_command_line, |
| 362 otr_switches, | 362 otr_switches, |
| 363 command_line); | 363 command_line); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void RestartChrome(const std::string& command_line) { | 366 void RestartChrome(const std::string& command_line) { |
| 367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 367 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 368 BootTimesRecorder::Get()->set_restart_requested(); | 368 BootTimesRecorder::Get()->set_restart_requested(); |
| 369 | 369 |
| 370 static bool restart_requested = false; | 370 static bool restart_requested = false; |
| 371 if (restart_requested) { | 371 if (restart_requested) { |
| 372 NOTREACHED() << "Request chrome restart for more than once."; | 372 NOTREACHED() << "Request chrome restart for more than once."; |
| 373 } | 373 } |
| 374 restart_requested = true; | 374 restart_requested = true; |
| 375 | 375 |
| 376 if (!base::SysInfo::IsRunningOnChromeOS()) { | 376 if (!base::SysInfo::IsRunningOnChromeOS()) { |
| 377 // Relaunch chrome without session manager on dev box. | 377 // Relaunch chrome without session manager on dev box. |
| 378 ReLaunch(command_line); | 378 ReLaunch(command_line); |
| 379 return; | 379 return; |
| 380 } | 380 } |
| 381 | 381 |
| 382 // ChromeRestartRequest deletes itself after request sent to session manager. | 382 // ChromeRestartRequest deletes itself after request sent to session manager. |
| 383 (new ChromeRestartRequest(command_line))->Start(); | 383 (new ChromeRestartRequest(command_line))->Start(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace chromeos | 386 } // namespace chromeos |
| OLD | NEW |