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_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/profiles/profile_io_data.h" | 35 #include "chrome/browser/profiles/profile_io_data.h" |
36 #include "chrome/browser/protector/protected_prefs_watcher.h" | 36 #include "chrome/browser/protector/protected_prefs_watcher.h" |
37 #include "chrome/browser/protector/protector_service.h" | 37 #include "chrome/browser/protector/protector_service.h" |
38 #include "chrome/browser/protector/protector_service_factory.h" | 38 #include "chrome/browser/protector/protector_service_factory.h" |
39 #include "chrome/browser/protector/protector_utils.h" | 39 #include "chrome/browser/protector/protector_utils.h" |
40 #include "chrome/browser/sessions/session_restore.h" | 40 #include "chrome/browser/sessions/session_restore.h" |
41 #include "chrome/browser/sessions/session_service.h" | 41 #include "chrome/browser/sessions/session_service.h" |
42 #include "chrome/browser/sessions/session_service_factory.h" | 42 #include "chrome/browser/sessions/session_service_factory.h" |
43 #include "chrome/browser/shell_integration.h" | 43 #include "chrome/browser/shell_integration.h" |
| 44 #include "chrome/browser/ui/browser_finder.h" |
44 #include "chrome/browser/ui/browser_list.h" | 45 #include "chrome/browser/ui/browser_list.h" |
45 #include "chrome/browser/ui/browser_navigator.h" | 46 #include "chrome/browser/ui/browser_navigator.h" |
46 #include "chrome/browser/ui/browser_window.h" | 47 #include "chrome/browser/ui/browser_window.h" |
47 #include "chrome/browser/ui/startup/autolaunch_prompt.h" | 48 #include "chrome/browser/ui/startup/autolaunch_prompt.h" |
48 #include "chrome/browser/ui/startup/bad_flags_prompt.h" | 49 #include "chrome/browser/ui/startup/bad_flags_prompt.h" |
49 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 50 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
50 #include "chrome/browser/ui/startup/obsolete_os_prompt.h" | 51 #include "chrome/browser/ui/startup/obsolete_os_prompt.h" |
51 #include "chrome/browser/ui/startup/session_crashed_prompt.h" | 52 #include "chrome/browser/ui/startup/session_crashed_prompt.h" |
52 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 53 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
53 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 54 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 } | 503 } |
503 } | 504 } |
504 | 505 |
505 // Session startup didn't occur, open the urls. | 506 // Session startup didn't occur, open the urls. |
506 | 507 |
507 Browser* browser = NULL; | 508 Browser* browser = NULL; |
508 std::vector<GURL> adjust_urls = urls_to_open; | 509 std::vector<GURL> adjust_urls = urls_to_open; |
509 if (adjust_urls.empty()) | 510 if (adjust_urls.empty()) |
510 AddStartupURLs(&adjust_urls); | 511 AddStartupURLs(&adjust_urls); |
511 else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) | 512 else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) |
512 browser = BrowserList::GetLastActiveWithProfile(profile_); | 513 browser = browser::FindLastActiveWithProfile(profile_); |
513 | 514 |
514 // This will launch a browser; prevent session restore. | 515 // This will launch a browser; prevent session restore. |
515 in_synchronous_profile_launch = true; | 516 in_synchronous_profile_launch = true; |
516 browser = OpenURLsInBrowser(browser, process_startup, adjust_urls); | 517 browser = OpenURLsInBrowser(browser, process_startup, adjust_urls); |
517 in_synchronous_profile_launch = false; | 518 in_synchronous_profile_launch = false; |
518 AddInfoBarsIfNecessary(browser, is_process_startup); | 519 AddInfoBarsIfNecessary(browser, is_process_startup); |
519 } | 520 } |
520 | 521 |
521 bool StartupBrowserCreatorImpl::ProcessStartupURLs( | 522 bool StartupBrowserCreatorImpl::ProcessStartupURLs( |
522 const std::vector<GURL>& urls_to_open) { | 523 const std::vector<GURL>& urls_to_open) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 // New: | 856 // New: |
856 prefs->GetString(prefs::kHomePage), | 857 prefs->GetString(prefs::kHomePage), |
857 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 858 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
858 prefs->GetBoolean(prefs::kShowHomeButton), | 859 prefs->GetBoolean(prefs::kShowHomeButton), |
859 // Backup: | 860 // Backup: |
860 backup_homepage, | 861 backup_homepage, |
861 backup_homepage_is_ntp, | 862 backup_homepage_is_ntp, |
862 backup_show_home_button)); | 863 backup_show_home_button)); |
863 } | 864 } |
864 } | 865 } |
OLD | NEW |