OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // On Linux, when the user tries to launch a second copy of chrome, we check | 5 // On Linux, when the user tries to launch a second copy of chrome, we check |
6 // for a socket in the user's profile directory. If the socket file is open we | 6 // for a socket in the user's profile directory. If the socket file is open we |
7 // send a message to the first chrome browser process with the current | 7 // send a message to the first chrome browser process with the current |
8 // directory and second process command line flags. The second process then | 8 // directory and second process command line flags. The second process then |
9 // exits. | 9 // exits. |
10 // | 10 // |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // Send back "SHUTDOWN" message, so that the client process can start up | 498 // Send back "SHUTDOWN" message, so that the client process can start up |
499 // without killing this process. | 499 // without killing this process. |
500 reader->FinishWithACK(kShutdownToken, arraysize(kShutdownToken) - 1); | 500 reader->FinishWithACK(kShutdownToken, arraysize(kShutdownToken) - 1); |
501 return; | 501 return; |
502 } | 502 } |
503 | 503 |
504 CommandLine parsed_command_line(argv); | 504 CommandLine parsed_command_line(argv); |
505 PrefService* prefs = g_browser_process->local_state(); | 505 PrefService* prefs = g_browser_process->local_state(); |
506 DCHECK(prefs); | 506 DCHECK(prefs); |
507 | 507 |
508 FilePath user_data_dir; | 508 Profile* profile = ProfileManager::GetDefaultProfile(); |
509 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | |
510 ProfileManager* profile_manager = g_browser_process->profile_manager(); | |
511 | |
512 #if defined(OS_CHROMEOS) | |
513 Profile* profile; | |
514 if (parsed_command_line.HasSwitch(switches::kProfile)) { | |
515 std::wstring profile_dir = | |
516 parsed_command_line.GetSwitchValue(switches::kProfile); | |
517 profile = profile_manager->GetProfile( | |
518 user_data_dir.Append(FilePath::FromWStringHack(profile_dir))); | |
519 } else { | |
520 profile = profile_manager->GetDefaultProfile(user_data_dir); | |
521 } | |
522 #else | |
523 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | |
524 #endif | |
525 | 509 |
526 if (!profile) { | 510 if (!profile) { |
527 // We should only be able to get here if the profile already exists and | 511 // We should only be able to get here if the profile already exists and |
528 // has been created. | 512 // has been created. |
529 NOTREACHED(); | 513 NOTREACHED(); |
530 return; | 514 return; |
531 } | 515 } |
532 | 516 |
533 // Run the browser startup sequence again, with the command line of the | 517 // Run the browser startup sequence again, with the command line of the |
534 // signalling process. | 518 // signalling process. |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 DCHECK(ml); | 765 DCHECK(ml); |
782 ml->PostTask(FROM_HERE, NewRunnableMethod( | 766 ml->PostTask(FROM_HERE, NewRunnableMethod( |
783 watcher_.get(), | 767 watcher_.get(), |
784 &ProcessSingleton::LinuxWatcher::StartListening, | 768 &ProcessSingleton::LinuxWatcher::StartListening, |
785 sock)); | 769 sock)); |
786 } | 770 } |
787 | 771 |
788 void ProcessSingleton::Cleanup() { | 772 void ProcessSingleton::Cleanup() { |
789 UnlinkPath(lock_path_.value()); | 773 UnlinkPath(lock_path_.value()); |
790 } | 774 } |
OLD | NEW |