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 29 matching lines...) Expand all Loading... |
40 #include "chrome/browser/extensions/unpacked_installer.h" | 40 #include "chrome/browser/extensions/unpacked_installer.h" |
41 #include "chrome/browser/first_run/first_run.h" | 41 #include "chrome/browser/first_run/first_run.h" |
42 #include "chrome/browser/google/google_util.h" | 42 #include "chrome/browser/google/google_util.h" |
43 #include "chrome/browser/notifications/desktop_notification_service.h" | 43 #include "chrome/browser/notifications/desktop_notification_service.h" |
44 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 44 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
45 #include "chrome/browser/prefs/session_startup_pref.h" | 45 #include "chrome/browser/prefs/session_startup_pref.h" |
46 #include "chrome/browser/profiles/profile.h" | 46 #include "chrome/browser/profiles/profile.h" |
47 #include "chrome/browser/profiles/profile_manager.h" | 47 #include "chrome/browser/profiles/profile_manager.h" |
48 #include "chrome/browser/profiles/profiles_state.h" | 48 #include "chrome/browser/profiles/profiles_state.h" |
49 #include "chrome/browser/search_engines/util.h" | 49 #include "chrome/browser/search_engines/util.h" |
| 50 #include "chrome/browser/ui/app_list/app_list_service.h" |
50 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
51 #include "chrome/browser/ui/browser_dialogs.h" | 52 #include "chrome/browser/ui/browser_dialogs.h" |
52 #include "chrome/browser/ui/browser_finder.h" | 53 #include "chrome/browser/ui/browser_finder.h" |
53 #include "chrome/browser/ui/browser_window.h" | 54 #include "chrome/browser/ui/browser_window.h" |
54 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 55 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
55 #include "chrome/common/chrome_constants.h" | 56 #include "chrome/common/chrome_constants.h" |
56 #include "chrome/common/chrome_paths.h" | 57 #include "chrome/common/chrome_paths.h" |
57 #include "chrome/common/chrome_result_codes.h" | 58 #include "chrome/common/chrome_result_codes.h" |
58 #include "chrome/common/chrome_switches.h" | 59 #include "chrome/common/chrome_switches.h" |
59 #include "chrome/common/chrome_version_info.h" | 60 #include "chrome/common/chrome_version_info.h" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 788 |
788 // static | 789 // static |
789 bool StartupBrowserCreator::ActivatedProfile() { | 790 bool StartupBrowserCreator::ActivatedProfile() { |
790 return profile_launch_observer.Get().activated_profile(); | 791 return profile_launch_observer.Get().activated_profile(); |
791 } | 792 } |
792 | 793 |
793 bool HasPendingUncleanExit(Profile* profile) { | 794 bool HasPendingUncleanExit(Profile* profile) { |
794 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 795 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
795 !profile_launch_observer.Get().HasBeenLaunched(profile); | 796 !profile_launch_observer.Get().HasBeenLaunched(profile); |
796 } | 797 } |
| 798 |
| 799 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, |
| 800 const CommandLine& command_line) { |
| 801 // If we are showing the app list then chrome isn't shown so load the app |
| 802 // list's profile rather than chrome's. |
| 803 if (command_line.HasSwitch(switches::kShowAppList)) { |
| 804 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
| 805 GetProfilePath(user_data_dir); |
| 806 } |
| 807 |
| 808 if (command_line.HasSwitch(switches::kProfileDirectory)) { |
| 809 return user_data_dir.Append( |
| 810 command_line.GetSwitchValuePath(switches::kProfileDirectory)); |
| 811 } |
| 812 |
| 813 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
| 814 user_data_dir); |
| 815 } |
OLD | NEW |