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 "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 | 739 |
| 740 // The profile isn't loaded yet and so needs to be loaded asynchronously. | 740 // The profile isn't loaded yet and so needs to be loaded asynchronously. |
| 741 if (!profile) { | 741 if (!profile) { |
| 742 profile_manager->CreateProfileAsync(profile_path, | 742 profile_manager->CreateProfileAsync(profile_path, |
| 743 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated, | 743 base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated, |
| 744 command_line, cur_dir), base::string16(), base::string16(), | 744 command_line, cur_dir), base::string16(), base::string16(), |
| 745 std::string()); | 745 std::string()); |
| 746 return; | 746 return; |
| 747 } | 747 } |
| 748 | 748 |
| 749 // If the profile is loaded and the --activate-existing-profile-browser flag | |
| 750 // is used, activate one of the profile's browser windows, if one exists. | |
| 751 // Continuing to process the command line is not needed, since this will | |
| 752 // end up opening a new browser window. | |
| 753 if (command_line.HasSwitch(switches::kActivateExistingProfileBrowser)) { | |
|
sky
2014/11/10 23:28:25
How do you know there isn't anything else interest
noms (inactive)
2014/11/12 19:04:11
This was originally in ProcessCmdLineImpl, but tap
| |
| 754 Browser* browser = chrome::FindTabbedBrowser( | |
| 755 profile, false, chrome::HOST_DESKTOP_TYPE_NATIVE); | |
| 756 if (browser) { | |
| 757 browser->window()->Activate(); | |
| 758 return; | |
| 759 } | |
| 760 } | |
| 761 | |
| 749 ProcessCmdLineImpl(command_line, cur_dir, false, profile, Profiles(), NULL, | 762 ProcessCmdLineImpl(command_line, cur_dir, false, profile, Profiles(), NULL, |
| 750 NULL); | 763 NULL); |
| 751 } | 764 } |
| 752 | 765 |
| 753 // static | 766 // static |
| 754 bool StartupBrowserCreator::ActivatedProfile() { | 767 bool StartupBrowserCreator::ActivatedProfile() { |
| 755 return profile_launch_observer.Get().activated_profile(); | 768 return profile_launch_observer.Get().activated_profile(); |
| 756 } | 769 } |
| 757 | 770 |
| 758 bool HasPendingUncleanExit(Profile* profile) { | 771 bool HasPendingUncleanExit(Profile* profile) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 770 // If we are showing the app list then chrome isn't shown so load the app | 783 // If we are showing the app list then chrome isn't shown so load the app |
| 771 // list's profile rather than chrome's. | 784 // list's profile rather than chrome's. |
| 772 if (command_line.HasSwitch(switches::kShowAppList)) { | 785 if (command_line.HasSwitch(switches::kShowAppList)) { |
| 773 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 786 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
| 774 GetProfilePath(user_data_dir); | 787 GetProfilePath(user_data_dir); |
| 775 } | 788 } |
| 776 | 789 |
| 777 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 790 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
| 778 user_data_dir); | 791 user_data_dir); |
| 779 } | 792 } |
| OLD | NEW |