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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 12090062: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable tests on aura Created 7 years, 10 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 (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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); 633 AutomationProviderList* list = g_browser_process->GetAutomationProviderList();
634 DCHECK(list); 634 DCHECK(list);
635 list->AddProvider(automation); 635 list->AddProvider(automation);
636 #endif // defined(ENABLE_AUTOMATION) 636 #endif // defined(ENABLE_AUTOMATION)
637 637
638 return true; 638 return true;
639 } 639 }
640 640
641 // static 641 // static
642 void StartupBrowserCreator::ProcessCommandLineOnProfileCreated( 642 void StartupBrowserCreator::ProcessCommandLineOnProfileCreated(
643 const CommandLine& cmd_line, 643 const CommandLine& command_line,
644 const FilePath& cur_dir, 644 const FilePath& cur_dir,
645 Profile* profile, 645 Profile* profile,
646 Profile::CreateStatus status) { 646 Profile::CreateStatus status) {
647 if (status == Profile::CREATE_STATUS_INITIALIZED) 647 if (status == Profile::CREATE_STATUS_INITIALIZED)
648 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, 648 ProcessCmdLineImpl(command_line, cur_dir, false, profile, Profiles(), NULL,
649 NULL); 649 NULL);
650 } 650 }
651 651
652 // static 652 // static
653 void StartupBrowserCreator::ProcessCommandLineAlreadyRunning( 653 void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
654 const CommandLine& cmd_line, 654 const CommandLine& command_line,
655 const FilePath& cur_dir) { 655 const FilePath& cur_dir,
656 if (cmd_line.HasSwitch(switches::kProfileDirectory)) { 656 const FilePath& profile_path) {
657 ProfileManager* profile_manager = g_browser_process->profile_manager(); 657 ProfileManager* profile_manager = g_browser_process->profile_manager();
658 FilePath path = cmd_line.GetSwitchValuePath(switches::kProfileDirectory); 658 Profile* profile = profile_manager->GetProfileByPath(profile_path);
659 path = profile_manager->user_data_dir().Append(path); 659
660 profile_manager->CreateProfileAsync(path, 660 // The profile isn't loaded yet and so needs to be loaded asynchronously.
661 if (!profile) {
662 profile_manager->CreateProfileAsync(profile_path,
661 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated, 663 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated,
662 cmd_line, cur_dir), string16(), string16(), false); 664 command_line, cur_dir), string16(), string16(), false);
663 return; 665 return;
664 } 666 }
665 667
666 Profile* profile = ProfileManager::GetLastUsedProfile(); 668 ProcessCmdLineImpl(command_line, cur_dir, false, profile, Profiles(), NULL,
667 if (!profile) { 669 NULL);
668 // We should only be able to get here if the profile already exists and
669 // has been created.
670 NOTREACHED();
671 return;
672 }
673 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
674 } 670 }
675 671
676 // static 672 // static
677 bool StartupBrowserCreator::ActivatedProfile() { 673 bool StartupBrowserCreator::ActivatedProfile() {
678 return profile_launch_observer.Get().activated_profile(); 674 return profile_launch_observer.Get().activated_profile();
679 } 675 }
680 676
681 bool HasPendingUncleanExit(Profile* profile) { 677 bool HasPendingUncleanExit(Profile* profile) {
682 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && 678 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED &&
683 !profile_launch_observer.Get().HasBeenLaunched(profile); 679 !profile_launch_observer.Get().HasBeenLaunched(profile);
684 } 680 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.h ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698