Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 Profile* profile, | 578 Profile* profile, |
| 579 Profile::CreateStatus status) { | 579 Profile::CreateStatus status) { |
| 580 if (status == Profile::CREATE_STATUS_INITIALIZED) | 580 if (status == Profile::CREATE_STATUS_INITIALIZED) |
| 581 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, | 581 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, |
| 582 NULL); | 582 NULL); |
| 583 } | 583 } |
| 584 | 584 |
| 585 // static | 585 // static |
| 586 void StartupBrowserCreator::ProcessCommandLineAlreadyRunning( | 586 void StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
| 587 const CommandLine& cmd_line, | 587 const CommandLine& cmd_line, |
| 588 const FilePath& cur_dir) { | 588 const FilePath& cur_dir, |
| 589 if (cmd_line.HasSwitch(switches::kProfileDirectory)) { | 589 const FilePath& profile_path) { |
| 590 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 590 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 591 FilePath path = cmd_line.GetSwitchValuePath(switches::kProfileDirectory); | 591 FilePath user_data_dir = profile_manager->user_data_dir(); |
|
benwells
2013/01/18 06:18:46
Is user_data_dir used?
koz (OOO until 15th September)
2013/01/20 23:32:00
Oops, nope. Removed.
| |
| 592 path = profile_manager->user_data_dir().Append(path); | 592 Profile* profile = profile_manager->GetProfileByPath(profile_path); |
| 593 profile_manager->CreateProfileAsync(path, | 593 |
| 594 // The profile isn't loaded yet and so needs to be loaded asynchronously. | |
| 595 if (!profile) { | |
| 596 profile_manager->CreateProfileAsync(profile_path, | |
| 594 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated, | 597 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated, |
| 595 cmd_line, cur_dir), string16(), string16(), false); | 598 cmd_line, cur_dir), string16(), string16(), false); |
| 596 return; | 599 return; |
| 597 } | 600 } |
| 598 | 601 |
| 599 Profile* profile = ProfileManager::GetLastUsedProfile(); | |
| 600 if (!profile) { | |
| 601 // We should only be able to get here if the profile already exists and | |
| 602 // has been created. | |
| 603 NOTREACHED(); | |
| 604 return; | |
| 605 } | |
| 606 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 602 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
| 607 } | 603 } |
| 608 | 604 |
| 609 bool HasPendingUncleanExit(Profile* profile) { | 605 bool HasPendingUncleanExit(Profile* profile) { |
| 610 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 606 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
| 611 !profile_launch_observer.Get().HasBeenLaunched(profile); | 607 !profile_launch_observer.Get().HasBeenLaunched(profile); |
| 612 } | 608 } |
| OLD | NEW |