| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> // For max(). | 9 #include <algorithm> // For max(). |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 base::Bind(&ProcessCommandLineOnProfileCreated, command_line, cur_dir), | 893 base::Bind(&ProcessCommandLineOnProfileCreated, command_line, cur_dir), |
| 894 base::string16(), std::string(), std::string()); | 894 base::string16(), std::string(), std::string()); |
| 895 return; | 895 return; |
| 896 } | 896 } |
| 897 StartupBrowserCreator startup_browser_creator; | 897 StartupBrowserCreator startup_browser_creator; |
| 898 startup_browser_creator.ProcessCmdLineImpl(command_line, cur_dir, false, | 898 startup_browser_creator.ProcessCmdLineImpl(command_line, cur_dir, false, |
| 899 profile, Profiles()); | 899 profile, Profiles()); |
| 900 } | 900 } |
| 901 | 901 |
| 902 // static | 902 // static |
| 903 void StartupBrowserCreator::OpenStartupPages(Browser* browser, |
| 904 bool process_startup) { |
| 905 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 906 chrome::startup::IsFirstRun is_first_run = |
| 907 first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN |
| 908 : chrome::startup::IS_NOT_FIRST_RUN; |
| 909 StartupBrowserCreatorImpl startup_browser_creator_impl( |
| 910 base::FilePath(), command_line, is_first_run); |
| 911 SessionStartupPref session_startup_pref = |
| 912 StartupBrowserCreator::GetSessionStartupPref(command_line, |
| 913 browser->profile()); |
| 914 startup_browser_creator_impl.OpenURLsInBrowser(browser, process_startup, |
| 915 session_startup_pref.urls); |
| 916 } |
| 917 |
| 918 // static |
| 903 bool StartupBrowserCreator::ActivatedProfile() { | 919 bool StartupBrowserCreator::ActivatedProfile() { |
| 904 return profile_launch_observer.Get().activated_profile(); | 920 return profile_launch_observer.Get().activated_profile(); |
| 905 } | 921 } |
| 906 | 922 |
| 907 bool HasPendingUncleanExit(Profile* profile) { | 923 bool HasPendingUncleanExit(Profile* profile) { |
| 908 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 924 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
| 909 !profile_launch_observer.Get().HasBeenLaunched(profile); | 925 !profile_launch_observer.Get().HasBeenLaunched(profile); |
| 910 } | 926 } |
| 911 | 927 |
| 912 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, | 928 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 if (!entry->IsSigninRequired()) { | 1008 if (!entry->IsSigninRequired()) { |
| 993 Profile* profile = profile_manager->GetProfile(entry->GetPath()); | 1009 Profile* profile = profile_manager->GetProfile(entry->GetPath()); |
| 994 if (profile) | 1010 if (profile) |
| 995 return profile; | 1011 return profile; |
| 996 } | 1012 } |
| 997 } | 1013 } |
| 998 | 1014 |
| 999 return nullptr; | 1015 return nullptr; |
| 1000 } | 1016 } |
| 1001 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 1017 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| OLD | NEW |