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

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

Issue 11968034: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: git://nomatter.syd/chromium/src.git@master
Patch Set: respond to comments Created 7 years, 11 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 AutomationProviderList* list = g_browser_process->GetAutomationProviderList(); 660 AutomationProviderList* list = g_browser_process->GetAutomationProviderList();
661 DCHECK(list); 661 DCHECK(list);
662 list->AddProvider(automation); 662 list->AddProvider(automation);
663 #endif // defined(ENABLE_AUTOMATION) 663 #endif // defined(ENABLE_AUTOMATION)
664 664
665 return true; 665 return true;
666 } 666 }
667 667
668 // static 668 // static
669 void StartupBrowserCreator::ProcessCommandLineOnProfileCreated( 669 void StartupBrowserCreator::ProcessCommandLineOnProfileCreated(
670 const CommandLine& cmd_line, 670 const CommandLine& command_line,
671 const FilePath& cur_dir, 671 const FilePath& cur_dir,
672 Profile* profile, 672 Profile* profile,
673 Profile::CreateStatus status) { 673 Profile::CreateStatus status) {
674 if (status == Profile::CREATE_STATUS_INITIALIZED) 674 if (status == Profile::CREATE_STATUS_INITIALIZED)
675 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, 675 ProcessCmdLineImpl(command_line, cur_dir, false, profile, Profiles(), NULL,
676 NULL); 676 NULL);
677 } 677 }
678 678
679 // static 679 // static
680 void StartupBrowserCreator::ProcessCommandLineAlreadyRunning( 680 void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
681 const CommandLine& cmd_line, 681 const CommandLine& command_line,
682 const FilePath& cur_dir) { 682 const FilePath& cur_dir,
683 if (cmd_line.HasSwitch(switches::kProfileDirectory)) { 683 const FilePath& profile_path) {
684 ProfileManager* profile_manager = g_browser_process->profile_manager(); 684 ProfileManager* profile_manager = g_browser_process->profile_manager();
685 FilePath path = cmd_line.GetSwitchValuePath(switches::kProfileDirectory); 685 Profile* profile = profile_manager->GetProfileByPath(profile_path);
686 path = profile_manager->user_data_dir().Append(path); 686
687 profile_manager->CreateProfileAsync(path, 687 // The profile isn't loaded yet and so needs to be loaded asynchronously.
688 if (!profile) {
689 profile_manager->CreateProfileAsync(profile_path,
688 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated, 690 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated,
689 cmd_line, cur_dir), string16(), string16(), false); 691 command_line, cur_dir), string16(), string16(), false);
690 return; 692 return;
691 } 693 }
692 694
693 Profile* profile = ProfileManager::GetLastUsedProfile(); 695 ProcessCmdLineImpl(command_line, cur_dir, false, profile, Profiles(), NULL,
694 if (!profile) { 696 NULL);
695 // We should only be able to get here if the profile already exists and
696 // has been created.
697 NOTREACHED();
698 return;
699 }
700 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
701 } 697 }
702 698
703 // static 699 // static
704 bool StartupBrowserCreator::ActivatedProfile() { 700 bool StartupBrowserCreator::ActivatedProfile() {
705 return profile_launch_observer.Get().activated_profile(); 701 return profile_launch_observer.Get().activated_profile();
706 } 702 }
707 703
708 bool HasPendingUncleanExit(Profile* profile) { 704 bool HasPendingUncleanExit(Profile* profile) {
709 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && 705 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED &&
710 !profile_launch_observer.Get().HasBeenLaunched(profile); 706 !profile_launch_observer.Get().HasBeenLaunched(profile);
711 } 707 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698